Find out which remote branch a local branch is tracking

Here is a command that gives you all tracking branches (configured for ‘pull’), see:

$ git branch -vv
  main   aaf02f0 [main/master: ahead 25] Some other commit
* master add0a03 [jdsumsion/master] Some commit

You have to wade through the SHA and any long-wrapping commit messages, but it’s quick to type and I get the tracking branches aligned vertically in the 3rd column.

If you need info on both ‘pull’ and ‘push’ configuration per branch, see the other answer on git remote show origin.


Update

Starting in git version 1.8.5 you can show the upstream branch with git status and git status -sb

Leave a Comment