Re: followRemoteHEAD management question
- From
Matt Hunter <m@lfurio.us>
- Date
- Jun 11, 2026, 04:12 UTC
- Message-ID
- <DJ5XE9HC5YNY.33U8AG1GX6ZP0@lfurio.us>
- In-Reply-To
- <20260608234946.GB358144@coredump.intra.peff.net>
On Mon Jun 8, 2026 at 7:49 PM EDT, Jeff King wrote:
Show 11 quoted lines
>> >> The topic mentioned above (merged in a1f34d595503) adds a new >> configuration key 'remote.<name>.followRemoteHEAD'. I'm assuming that >> the intended use for followRemoteHEAD is really only in local / >> per-repository config, since trying to apply it to my personal >> .gitconfig has some odd behavior. > > I think this is a gap in the new feature's implementation. It added > per-remote config, but there is no global config to fall back to (e.g., > the way that remote.*.prune falls back to fetch.prune). There should be > a fetch.followRemoteHEAD option (or perhaps remote.followRemoteHEAD).
Earlier on while working on this, I actually settled on fetch.followRemoteHEAD instead, taking example from the prune setting. Thanks for the confirmation.
Show 13 quoted lines
>> The <name> in the key template does not accept a wildcard, so I must >> list out each of the common remote names I use across different >> repositories. Since many of my repos don't actually have remotes >> established for all of these names, they pick up a kind of half-baked >> definition for each of them as git performs its config parsing. For >> instance, a name will appear under 'git remote -v', but it won't >> have any actual properties configured. > > Yes, this is a common problem with the remote-config namespace. Defining > _any_ key makes the remote "exist", even without a defined url, but that > isn't usually the intent. But we can't distinguish that from the case > where you really do want to define a remote without a url (in which case > the url is the name of the remote).
I had no idea a remote like that was supported. Interesting.
Show 11 quoted lines
>> Is there another solution in place I've missed? If not, would there be >> any opposition to a new key like 'remote.followRemoteHEAD' which serves >> to provide a default value for any remote that doesn't have its own >> 'remote.<name>.followRemoteHEAD' key? >> >> I've started scouting out changes to make for such a patch. It's not >> ready yet, but I figured I would throw this question out in case an easy >> answer can save the effort. > > I think you are on the right track. I can see arguments for or against > putting it in fetch.* or remote.*, so you'll have to pick one. ;)
As stated, I think putting it in fetch.* is more consistent. I'd be curious to hear arguments the other way.
As for another design decision: I'm leaning toward omitting support for the "warn-if-not-$branch" value in fetch.followRemoteHEAD.
My take on that option as-documented is that it serves more as an acknowledgment from the user that "yes, I understand that origin has pointed HEAD at foo, please only warn me if it changes" as opposed to the user expressing that the branch "foo" is in some way special to them.
This interpretation feels very remote-dependent and doesn't make sense in the context of a default catch-all value to me.
Thanks for the feedback!