How to fetch all remote branches?
Check you git config --get remote.origin.fetch
refspec.
It would only fetch all branches if the refspec is
+refs/heads/*:refs/remotes/origin/*
If the refspec is:
+refs/heads/develop:refs/remotes/origin/develop
Then a fetch
would only bring back the develop
branch.
This is typical of a git clone --branch develop --single-branch
.
you can check your branch cat .git/config
in terminal
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
url = { git remote url }
fetch = +refs/heads/develop:refs/remotes/origin
[branch "develop"]
remote = origin
merge = refs/heads/develop
and git remote update
but not update remote branch.
you will replace origin fetch
first, check remote fetch git config --get remote.origin.fetch
+refs/heads/develop:refs/remotes/origin/develop
second, unset remote fetch use git config --unset-all remote.origin.fetch
and add another git config --add remote.origin.fetch +refs/heads/\*:refs/remotes/origin/feature/\*
then, you can check replace remote git config --get remote.origin.fetch
+refs/heads/*:refs/remotes/origin/*