0

我试图使用 pygit2 来完成这项任务,但我很困惑如何在 repo 中使用 diff 函数来执行此操作https://www.pygit2.org/diff.html

from pygit2 import Repository
from pygit2 import GIT_SORT_TOPOLOGICAL
repo = Repository('.git')
base = 'sdfsdfsdfsdfsdfsd'  # base tag
commits_in_between = []
for commit in repo.walk(repo.head.target, GIT_SORT_TOPOLOGICAL):
    print(commit.hex)
    commits_in_between.append(commit)
    if commit.hex == base:
        break

我现在唯一知道的就是拿走头部,然后往回走,直到你点击base然后可能保存提交十六进制。

4

0 回答 0