小编Tea*_*rth的帖子

如何在 GitPython 中向 Git 存储库添加已修改、已删除、未跟踪的内容

我认为 update=True 会将所有已修改、已删除和未跟踪的文件添加到索引中。我不知道方法是什么。有人可以帮我吗?

repo = Repo(working_repository_url)
repo.git.add(update=True)
repo.index.commit(my_msg)
Run Code Online (Sandbox Code Playgroud)

我是说。我当然可以得到:

untracked_items = repo.untracked_files
Run Code Online (Sandbox Code Playgroud)

这仅适用于未跟踪的文件。我想将未跟踪的文件、删除的、修改的文件添加到索引中,然后对所有文件进行提交。

我更有可能正在寻找相当于git add --all

python git gitpython

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

git ×1

gitpython ×1

python ×1