Search code examples
git

How can I see which Git branches are tracking which remote / upstream branch?


I know I can do git branch --all, and that shows me both local and remote branches, but it's not that useful in showing me the relationships between them.

How do I list branches in a way that shows which local branch is tracking which remote?


Solution

  • Very much a porcelain command, not good if you want this for scripting:

    git branch -vv   # doubly verbose!
    

    Note that with git 1.8.3, that upstream branch is displayed in blue (see "What is this branch tracking (if anything) in git?")


    If you want clean output, see Carl Suster's answer - it uses a plumbing command that I don't believe existed at the time I originally wrote this answer, so it's a bit more concise and works with branches configured for rebase, not just merge.