Answer by Philip Gaudreau for Using GitPython module to get remote HEAD branch
next(ref for ref in repo.remotes.origin.refs if ref.name == "origin/HEAD").ref.namerepo.remotes.origin.refs will give you a list of the remote branches. Filter on the one that is the HEAD and check...
View ArticleAnswer by Mark Riggins for Using GitPython module to get remote HEAD branch
To print the current branch:print(repo.head.ref)To list branchesprint [str(b) for b in repo.heads]To checkout a branchrepo.heads[branch].checkout()or repo.git.checkout(branch)If you're trying to delete...
View ArticleAnswer by moisesvega for Using GitPython module to get remote HEAD branch
I just saw your question I was wondering about this gitPython, looks like really nice tool, and I was looking for this specific question in the GitPython documentation with no lucky but if you search...
View ArticleUsing GitPython module to get remote HEAD branch
I'm trying to use GitPython to write some Python scripts which I can use it to simplify my daily tasks as I manage many branches.I'm also quite new for Python when it comes to writing complicated...
View Article