0

How one can know about the master/main branch at git remote with git-python.

I am aware that we can iterate over the heads of the repository and then check the results. Something like

repo = git.Repo('git-repo')
remote_refs = repo.remote().refs

for refs in remote_refs:
    print(refs)

This will give list of all branch heads at remote including the main/master branch.

Is their a direct way to get the main branch?

John Byro
  • 584
  • 1
  • 10

0 Answers0