PyGithub-如何获得特定分支的所有提交列表



我需要检查对github上特定分支的所有提交。

我知道

repo.get_commits() 

但我想这会返回该存储库的所有分支的提交。我在Commit类和Gitcommit类中都没有找到任何分支属性。

此外,Branch类中也没有类似.get_commits((的内容

解决这个问题的正确方法是什么?

正如这里所讨论的,这应该使用GitHub API List Commits

get /repos/{owner}/{repo}/commits

将要列出提交的sha或分支名称作为参数。

IbPyGitHub,即github.Repository.Repository.get_commits(),其中sha – string是分支的名称。

这将返回github.Commit.Commitgithub.PaginatedList.PaginatedList

最新更新