Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checkout or list remote branches in GitPython

I don't see an option to checkout or list remote/local branches in this module: https://gitpython.readthedocs.io/en/stable/

like image 740
Mike Avatar asked Mar 18 '10 20:03

Mike


1 Answers

For those who want to just print the remote branches:

# Execute from the repository root directory
repo = git.Repo('.')
remote_refs = repo.remote().refs

for refs in remote_refs:
    print(refs.name)
like image 148
Don Charlie Avatar answered Sep 28 '22 07:09

Don Charlie