Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out which remote branch a local branch is tracking

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

How can I find out which remote branch a local branch is tracking?

Do I need to parse git config output, or is there a command that would do this for me?

like image 209
readonly Avatar asked Oct 05 '08 05:10

readonly


Video Answer


1 Answers

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

like image 186
jdsumsion Avatar answered Sep 23 '22 04:09

jdsumsion