From: Phillip Wood <phillip.wood123@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
"Douglas Puchalski (dpuchals)" <dpuchals@cisco.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [Feature request] Separate explicit fetch mapping from default fetch selection
Date: Fri, 7 Aug 2026 14:08:22 +0100 [thread overview]
Message-ID: <10103c22-af8f-4bf3-b4ab-a3e4ce0491d4@gmail.com> (raw)
In-Reply-To: <xmqqcxvuhcrg.fsf@gitster.g>
On 07/08/2026 03:42, Junio C Hamano wrote:
> "Douglas Puchalski (dpuchals)" <dpuchals@cisco.com> writes:
>
>> Git version: 2.55.0
>> Environment: macOS 26.6
>>
>> I configure a remote to fetch only a small default set of branches:
>>
>> [remote "origin"]
>> fetch = +refs/heads/main:refs/remotes/origin/main
>> fetch = +refs/heads/team/*:refs/remotes/origin/team/*
>>
>> This prevents `git fetch origin` from fetching and updating a very large
>> number of remote branches.
>>
>> When I explicitly request another branch:
>>
>> git fetch origin topic/example
>>
>> Git fetches the branch into FETCH_HEAD but does not create or update:
>>
>> refs/remotes/origin/topic/example
That annoys me too. There is a similar problem with the push refspec if
you want to use it to map the refname rather than specify a default set
of branches to push.
> I haven't thought things through, but I suspect that what you want
> might be an opposite of explicitly listing what is tracked on
> remote.*.fetch configuration, but having remotes/origin/* hierarchy
> of refs as the source of the tracking information.
>
> It was a long ago this was invented, and I haven't used it for
> almost forever, but shouldn't this
>
> $ git fetch \
> --refmap="refs/heads/*:refs/remotes/origin/*" \
> origin topic/example
>
> do what you want to do? If so, perhaps it would make a good
> starting point to make it easier to use (e.g., perhaps a
> configuration variable can specify the refmap to be used, or
> something).
So we'd have something like "remote.<remote>.fetchMap" and
"remote.<remote>.pushMap" that mapped refnames, but did not affect what
gets fetched or push by default? That sounds useful (I've not thought
through the interaction with the existing settings though).
One of my other bugbears about the refspec config is that the first
matching one wins, rather than the longest match so you have to edit the
config file rather than use "git config" to add a refspec that matches a
sepcific branch, otherwise the default "refs/heads/*:..." that's created
when the remote is added is used instead because it comes first.
Thanks
Phillip
next prev parent reply other threads:[~2026-08-07 13:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 22:26 [Feature request] Separate explicit fetch mapping from default fetch selection Douglas Puchalski (dpuchals)
2026-08-07 2:42 ` Junio C Hamano
2026-08-07 13:08 ` Phillip Wood [this message]
2026-08-07 14:55 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10103c22-af8f-4bf3-b4ab-a3e4ce0491d4@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=dpuchals@cisco.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox