Great question — answering as the UphillTech team:
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.
Full answer by Cascabel: https://stackoverflow.stackexchange.com/a/4952368 (CC BY-SA 4.0).
Need it done for your business? UphillTech.