Somehow one of my repositories refuses to fetch new branches:
C:\temp>git fetch --all
Fetching origin
C:\temp>git branch -a
* develop
remotes/origin/develop
C:\temp>git ls-remote --heads origin
d130c97c1ccbe9ab35cd6e268c760781e37e3628 refs/heads/2.1.0.x
...
92685125df152fe053a2818de0c4d2ce8655c6b8 refs/heads/2.2.5.x
1e2eec16c7d63c84d6b53d0a221d22109b4de2a8 refs/heads/develop
f6447d5315fe777803b283bee7dac1dbdba92536 refs/heads/feature/0001089__icons_are_gone_-_move_inclusion_to_RC_files
e2cf0112b7e7fc18eb3467c7c42657208147efb2 refs/heads/feature/0001102__Debug_time_fix_exception_EIdSocketError_10060
6b2c89c6a39b3ce26cf42c5e8e5e0dd12c88abac refs/heads/feature/0001103__Research_cause_of_Internal_error_Stack_not_balanced
...
9f724b76b7c3533996fa03189e18a2f61fa5cf4f refs/heads/master
c233696172eb05522d1bb6705a3ea8cd730a762d refs/heads/origin/master
1db38f4fab2c41ee1931c9c6165aa6087556210a refs/heads/release
c233696172eb05522d1bb6705a3ea8cd730a762d refs/heads/trunk
How can I force git
to fetch all these remote branches?
I'm at git version 2.8.2.windows.1
.
Thanks for the lead! git fetch -all fetches all branches of all remotes. git fetch origin fetches all branches of the remote origin .
The git remote -r command lets you see a list of all the branches on a particular remote. If you need more information about the remotes associated with a repository, you can use the git remote show command.
1 Answer. git fetch --all and git pull -all will only track the remote branches and track local branches that track remote branches respectively. Run this command only if there are remote branches on the server which are untracked by your local branches.
The git fetch command allows to fetch all branches simultaneously from a remote repository.
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/*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With