Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote branch is not showing up in "git branch -r"

Tags:

git

People also ask

Does git branch show remote branches?

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 .


Update your remote if you still haven't done so:

$ git remote update
$ git branch -r

The remote section also specifies fetch rules. You could add something like this into it to fetch all branches from the remote:

fetch = +refs/heads/*:refs/remotes/origin/*

(Or replace origin with bitbucket.)

Please read about it here: 10.5 Git Internals - The Refspec


If you clone with the --depth parameter, it sets .git/config not to fetch all branches, but only master.

You can simply omit the parameter or update the configuration file from

fetch = +refs/heads/master:refs/remotes/origin/master

to

fetch = +refs/heads/*:refs/remotes/origin/*

I had the same issue. It seems the easiest solution is to just remove the remote, readd it, and fetch.