我试过了GitPython,但我只是得到了实际的提交 git hash。
import git
repo = git.Repo(search_parent_directories=True)
repo.head.commit.hexsha
但是,为了可追溯性,我想存储特定文件的 git commit 哈希,即此命令的等效项(使用git)
git log -n 1 --pretty=format:%h -- experiments/test.yaml
有可能实现GitPython吗?