Git Branch List

Post by on December 4, 2012

One major issue I run into with Git branches is that Git is tailored to be solely locally scoped, unless specified otherwise. For example, to list all branches and tell if they are remote tracking one would need to run:

$ git branch -vv

However, this leaves out any remote branches that aren't being tracked. It is clear that the designers wanted local and remote branches to be distinct. However, I suspect that many like myself work with repos that have only one remote and that need a seamless integration between local and remote branches. For this purpose, I extended Git with a git branch-list command that lists remote tracking branches, remote branches, and local branches all at once.

Special thanks to Jefromi for posting code on StackOverflow which inspired this script.

For reference on how to install this script, see "How to Write and Install a Custom Git Script".

UPDATE: I have added a set of tools, including this one, to the "Git Extras" GitHub repository.

Older Posts »