Reputation: 189
Git configuration branch.<name>.fetch
is mentioned in the first git-fetch
example1:
Update the remote-tracking branches:
$ git fetch origin
The above command copies all branches from the remote refs/heads/ namespace and stores them to the local refs/remotes/origin/ namespace, unless the branch..fetch option is used to specify a non-default refspec.
But I can't find its doc in git-config
's doc. Did branch.<name>.fetch
ever exist?
Searching in git-config
's doc for configs starting with branch.
or ending with .fetch
, it seems branch.<name>.fetch
is a typo of remote.<name>.fetch
.
1 This example was added in commit d504f69 in 2009.
Upvotes: 5
Views: 90
Reputation: 189
Confirmed by both @phd in comment and Junio C Hamano in git mailing list (see the full thread), Git configuration branch.<name>.fetch
is indeed a typo.
On Jan 16, 2023, the commit that corrects it to remote.<repository>.fetch
is merged to "the" git
repo, currently only on next
branch, see merge commit a3ca60840b
.
According to git config
doc, remote.<repository>.fetch
sets the default <refspec>
for git fetch
. You can find doc for <refspec>
in git fetch
doc, "Configured Remote-Tracking Branches".
Since the typo has lasted from 2009 to 2023 (suppose next git release will happen in 2023), there're many copies of full or excerpted git fetch
docs containing that typo all over the web. I will try to fix some of them found on Stack Overflow and Stack Exchange Network, after the next git
release hence the official git-fetch
doc adapts the typo fix.
Git 2.40 (Q1 2023) includes this doc fix:
See commit ca554bf (14 Jan 2023) by Yukai Chou (muzimuzhi
).
(Merged by Junio C Hamano -- gitster
-- in commit 86ccd39, 21 Jan 2023)
doc
: fix non-existent config nameSigned-off-by: Yukai Chou
Replace non-existent
branch.<name>.fetch
toremote.<repository>.fetch
, in the first example ingit-fetch
doc, which was introduced in d504f69 ("modernize fetch/merge/pull examples", 2009-10-21, Git v1.6.6-rc0 -- merge).Rename placeholder
<name>
to<repository>
, to be consistent with all other uses in git docs, except thatgit-config.txt
usesremote.<name>.fetch
in its "Variables" section.Also add missing monospace markups.
git fetch
now includes in its man page:
The above command copies all branches from the remote
refs/heads/
namespace and stores them to the localrefs/remotes/origin/
namespace, unless theremote.<repository>.fetch
option is used to specify a non-default refspec.
Upvotes: 3