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?
There is a command that gives you about all tracking branches. And to know about the pull and push configuration per branch you can use the command git remote show origin. and you can use -sb option for seeing the upstream. Hope this information will help you to find which branch is tracking.
To view your remote branches, simply pass the -r flag to the git branch command. You can inspect remote branches with the usual git checkout and git log commands. If you approve the changes a remote branch contains, you can merge it into a local branch with a normal git merge .
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 arcresu's answer - it uses a porcelain 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With