I just tested it on a local clone of the Git repo (https://github.com/git/git/)
The first fetch does return nothing
vonc@voncvb C:\Users\vonc\prog\git\git
> git fetch
The config is already set to the default value:
vonc@voncvb C:\Users\vonc\prog\git\git
> git config remote.origin.fetch
+refs/heads/*:refs/remotes/origin/*
If I set again the config, and do a git fetch, I do see indeed additional information:
vonc@voncvb C:\Users\vonc\prog\git\git
> git config remote.origin.fetch "+refs/heads/*:refs/remote/origin/*"
vonc@voncvb C:\Users\vonc\prog\git\git
> git fetch
From https://github.com/git/git
* [new branch] master -> refs/remote/origin/master
* [new branch] maint -> refs/remote/origin/maint
* [new branch] next -> refs/remote/origin/next
* [new branch] pu -> refs/remote/origin/pu
* [new branch] todo -> refs/remote/origin/todo
But if I repeat the git config command again (git config remote.origin.fetch "+refs/heads/*:refs/remote/origin/*"
) and do additional git fetch
, they won't return any new information (empty output)
That is because the first one completed the FETCH_HEAD
:
vonc@voncvb C:\Users\vonc\prog\git\git
> more .git\FETCH_HEAD
e3331758f12da22f4103eec7efe1b5304a9be5e9 branch 'master' of https://github.com/git/git
fc54c1af3ec09bab8b8ea09768c2da4069b7f53e not-for-merge branch 'maint' of https://github.com/git/git
fac676dfb9e0fea308fef5113ed7db2362fcdc9e not-for-merge branch 'next' of https://github.com/git/git
5fc3b55b9a8ca42699202482765d9768020ee313 not-for-merge branch 'pu' of https://github.com/git/git
be70464a91c93a321dc16707dec820870df970d2 not-for-merge branch 'todo' of https://github.com/git/git
In other words, it does not fetch any data, it only updates the references already fetched.
See "What does FETCH_HEAD
in Git mean?"