Using pygithub how to get latest commit on specific branch in a repo equivalent to github rest api https://{github.com}/api/v3/repos/{repo/}/{org}/commits/{branch}?per_page=1 I followed the steps mentioned in pygithub - Receive all commits of a specific branch , It's returning null.
branches = repo.get_branches() for branch in branches: print(branch.name) commits = repo.get_commits(path="tree/"+branch.name) for commit in commits: print(commit)