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

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


remote show shows all the branches on the remote, including those that are not tracked locally and even those that have not yet been fetched.

git remote show <remote-name>

It also tries to show the status of the branches relative to your local repository:

> git remote show origin* remote origin  Fetch URL: C:/git/.\remote_repo.git  Push  URL: C:/git/.\remote_repo.git  HEAD branch: master  Remote branches:    branch_that_is_not_even_fetched new (next fetch will store in remotes/origin)    branch_that_is_not_tracked      tracked    branch_that_is_tracked          tracked    master                          tracked  Local branches configured for 'git pull':    branch_that_is_tracked merges with remote branch_that_is_tracked    master                 merges with remote master  Local refs configured for 'git push':    branch_that_is_tracked pushes to branch_that_is_tracked (fast-forwardable)    master                 pushes to master                 (up to date)