Home » Errors & Failures » Git Errors » Fix : “git branch -r” not showing all remote branches

Fix : “git branch -r” not showing all remote branches

When you have a git repository which is actively maintained on centralised server, and you have cloned this repository some time back,

You can check which are the remote branches actively getting pushed on the server using below command “git branch -r”,

$ git branch -r

origin/HEAD -> origin/master
origin/master

As you can see, “git branch -r” command shown we have only master master branch in remote git, but when actually visited the same git using browser interface available from that server, we could find there are few more branches got pushed / created by someone.. but our git was not showing those branches in our local git using “git branch -r” command.

Solution :

If you faced such situation, just run below command,

$ git fetch --all

and if you run the same command “git branch -r” you can now see all the branches available in remote git.

$ git branch -r

origin/HEAD -> origin/master
origin/master
origin/remote_branch_name1
origin/remote_branch_name2
How to fix common errors in git
How to fix common errors in git

Leave a Comment

Sign up to our newsletter!