![](/img/trans.png)
[英]GitPython — How to 'git stash' changes to a GitPython repository?
[英]GitPython - Add modified, deleted, untracked to Git Repository
我認為 update=True 會以某種方式將所有修改、刪除和未跟蹤的文件添加到索引中。 我不確定方法是什么。 有人可以在這里幫助我嗎?
repo = Repo(working_repository_url)
repo.git.add(update=True)
repo.index.commit(my_msg)
我是說。 我當然可以得到:
untracked_items = repo.untracked_files
這僅適用於未跟蹤的文件。 我想將未跟蹤的文件、已刪除、已修改的文件添加到索引中,然后對所有文件進行提交。
更有可能我正在尋找相當於git add --all
的東西
任何事情都會有所幫助。
謝謝!
嘗試
repo.git.add(all=True)
與git add --all
是一一對應的
要繼續使用 repo.index:
repo.index.add('**')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.