我正在使用 gitpython用于执行 git 操作的库,从 python 代码中检索 git 信息。我想检索特定文件的所有修订。但是在 docs 上找不到具体的引用资料.
谁能提供一些线索,说明哪个函数在这方面有帮助?谢谢。
最佳答案
后续,读取每个文件:
import git
repo = git.Repo()
path = "file_you_are_looking_for"
revlist = (
(commit, (commit.tree / path).data_stream.read())
for commit in repo.iter_commits(paths=path)
)
for commit, filecontents in revlist:
...
关于python - 在 gitpython 中获取特定文件的所有修订,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28803626/