I am trying to get all commit messages from a specific branch form github using pyGithub
in python. When I do repo.get_commits()
it only returns all commits from the master branch. I know there is an existing quesiton similar to this but I could not get an answer from that.
I tried doing:
gh = Github(token)
repo = gh.get_repo(f"{username}/{repo_name}")
branches = repo.get_branches() # gets all the branches within the repo
'''
This only prints 1 or 2 commit messages.
I have a branch with 300+ commits but it only prints 2 of the commit messages
How can I make it print ALL the commit messages?
'''
for branch in branches:
print(branch.commit.commit.message)