Remote git branches not shown with `git branch -r`?
I have two directories on my local machine pointing to the same remote git repository. When I issue the command git branch -r in one of the directories I get a longer list of remote branches then in the other directory. How is that possible ? It seems that some of the remote branches are 'hidden' in one directory and are visible in the other.
I had the same issue, couldn't get the remote branches on one of my local directories. git branch -r would show less branches and also not the top-most change, while on the other directory everything was refreshing nicely.
To fix this, I did git config -l on both directories and found out that I was missing the remote.origin.fetch setting. Running the following line fixed my problem:
git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/* git fetch From github.com:username/test2 2bd5e5e..2619d39 master -> origin/master * [new branch] remotebr2 -> origin/remotebr2 * [new branch] remotebranch -> origin/remotebranch
I think you should fetch and prune:
prune Deletes all stale tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in "remotes/<name>". With --dry-run option, report what branches will be pruned, but do not actually prune them.
With this commandlines:
git fetch git remote prune origin
Are both repositories up-to-date? Try running git fetch and see if that fixes it.