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 

   2bd5e5e..2619d39  master     -> origin/master
 * [new branch]      remotebr2  -> origin/remotebr2
 * [new branch]      remotebranch -> origin/remotebranch

I think you should fetch and 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.

Need Your Help

Case insensitive string comparison

php if-statement case-insensitive

I would like to compare two variables to see if they are the same, but I want this comparison to be case-insensitive.

How to pass a Numpy array into a cffi function and how to get one back out?

python arrays numpy python-cffi

I am developing an audio algorithm using Python and Numpy. Now I want to speed up that algorithm by implementing a part of it in C. In the past, I have done this using cython. Now I want to do the ...