From: D. Ben Knoble Date: Thu, 24 Sep 2026 17:10:47 GMT Subject: Re: [PATCH] fetch: add config to avoid fetching every branch in shallow repo Message-ID: In-Reply-To: On Wed, Sep 23, 2026 at 3:50 PM Junio C Hamano wrote: > > "D. Ben Knoble" writes: > > >> $ git fetch second main:refs/remotes/second/main > > > > I've wanted something similar for notes, so allow me to interject from > > the sidelines: it would be even nicer to still have the ability to map > > fetches (so that "git fetch second main" did the right thing, creating > > The thing is, the command line > > $ git fetch second main > > has been used for the past 20 years as a "single-shot fetch" syntax > that expresses that the user does not intend to keep interacting > with the same 'main' branch or even the same 'second' repository, > and for the "single-shot fetch", it is absolutely the wrong thing to > create a remote-tracking branch. Yes, perhaps I was a bit cavalier about that particular case; but in your other message you suggested allowing configurable refmaps, and that's what I was getting at previously without having the vocabulary for it. Thanks! > It would be even worse if we created a remote 'second' and > remote-tracking branch 'refs/remotes/second/main' when you ran > > $ git fetch https://ho.st/second main > > Having said that, I suspect that the fact that you have the > shorthand 'second' (i.e., you have "[remote "second"] url = ..." > defined) may be a good enough sign that you expect to keep > interacting with that repository, and some people might appreciate > it if > > $ git fetch second main > > created a remote-tracking branch "refs/remotes/second/main" > automatically. > > But we cannot suddenly start doing so without breaking people's > expectations, and without a good transition plan. We need at least > an escape hatch for users to say "No, this is a single-shot fetch; > do not write the object anywhere other than FETCH_HEAD as we have > always done". So anyway, I think fetch..refmap is the right thing here, thanks! -- D. Ben Knoble