Somebody pushed a branch called test
with git push origin test
to a shared repository. I can see the branch with git branch -r
.
For us, it seems the remote.origin.fetch
configuration gave a problem. Therefore, we could not see any other remote branches than master
, so git fetch [--all]
did not help. Neither git checkout mybranch
nor git checkout -b mybranch --track origin/mybranch
did work, although it certainly was at remote.
The previous configuration only allowed master
to be fetched:
$ git config --list | grep fetch
remote.origin.fetch=+refs/heads/master:refs/remotes/origin/master
Fix it by using *
and fetch the new information from origin:
$ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
$ git fetch
...
* [new branch] ...
...
Now we could git checkout
the remote branch locally.
No idea how this config ended up in our local repo.