How do I list all remote branches in Git 1.7+?

For the vast majority[1] of visitors here, the correct and simplest answer to the question “How do I list all remote branches in Git 1.7+?” is:

git branch -r

For a small minority[1] git branch -r does not work. If git branch -r does not work try:

git ls-remote --heads <remote-name>

If git branch -r does not work, then maybe as Cascabel says “you’ve modified the default refspec, so that git fetch and git remote update don’t fetch all the remote‘s branches”.


[1] As of the writing of this footnote 2018-Feb, I looked at the comments and see that the git branch -r works for the vast majority (about 90% or 125 out of 140).

If git branch -r does not work, check git config --get remote.origin.fetch contains a wildcard (*) as per this answer

Leave a Comment