I have been pushing to a remote Bitbucket repository and recently a colleague has pushed a new branch he created to the same repository.
I\'m trying to fetch the cha
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
I had the same issue. It seems the easiest solution is to just remove the remote, readd it, and fetch.
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/*
Unfortunately, git branch -a
and git branch -r
do not show you all remote branches, if you haven't executed a "git fetch".
git remote show origin
works consistently all the time. Also git show-ref
shows all references in the Git repository. However, it works just like the git branch
command.