![](/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.