From: Junio C Hamano Date: Wed, 23 Sep 2026 19:50:01 GMT Subject: Re: [PATCH] fetch: add config to avoid fetching every branch in shallow repo Message-ID: In-Reply-To: "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. 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".