我需要检查对 github 上特定分支所做的所有提交。
我知道
repo.get_commits()
但是我猜这会返回该存储库的所有分支的提交。我在 Commit class 和 Gitcommit class 中都没有找到任何分支属性。
在 Branch class 中也没有 .get_commits() 之类的东西
解决这个问题的正确方法是什么?
答案 0 :(得分:2)
作为 discussed here,这应该最终使用 GitHub API List Commits
get /repos/{owner}/{repo}/commits
将要列出提交的 sha 或分支名称作为参数。
Ib PyGitHub,即 github.Repository.Repository.get_commits()
,其中 sha – string
是分支的名称。
这将返回 github.PaginatedList.PaginatedList
的 github.Commit.Commit