[PATCH 0/7] Introduce fetch.followRemoteHEAD config option
- From
Matt Hunter <m@lfurio.us>
- Date
- Jun 12, 2026, 05:55 UTC
- Message-ID
- <20260612055947.1499497-1-m@lfurio.us>
- In-Reply-To
- <DJ19CI50W6UH.17QLIBNTXBWXU@lfurio.us>
git-fetch presently offers some useful ways to control how remote HEAD symbolic-refs are (or aren't) updated when fetching from remote repositories. Namely this is done via the 'remote.<name>.followRemoteHEAD' configuration option.
However, this option can be somewhat painful to use if you prefer a default other than the "create" option, and often work with multiple different remote repositories.
This series introduces the option 'fetch.followRemoteHEAD', which provides a configurable default in place of per-remote settings.
'fetch.followRemoteHEAD' functions exactly the same as the original option, except that it doesn't allow warning suppression via 'warn-if-not-$branch'. Given that different remotes will vary their HEAD and set of branches independently, setting a false-positive globally in this way doesn't make logical sense.
While it is not mentioned by any of the patches in this series, note also that the behavior introduced by 012bc566bad7 (remote set-head: set followRemoteHEAD to "warn" if "always") is unaffected by this series, and this feature continues to work for only the 'remote.<name>.followRemoteHEAD' option.
Matt Hunter (7): fetch: fixup set_head advice for warn-if-not-branch doc: explain fetchRemoteHEADWarn advice t5510: cleanup remote in followRemoteHEAD dangling ref test fetch: rename function report_set_head fetch: refactor do_fetch handling of followRemoteHEAD fetch: add configuration option fetch.followRemoteHEAD fetch: fixup a misaligned comment
Documentation/config/advice.adoc | 4 ++ Documentation/config/fetch.adoc | 19 ++++++ Documentation/config/remote.adoc | 21 +++--- builtin/fetch.c | 52 +++++++++++---- remote.h | 14 ++-- t/t5510-fetch.sh | 106 +++++++++++++++++++++++++++++++ 6 files changed, 186 insertions(+), 30 deletions(-)
base-commit: 1ff279f3404a482a83fb04c7457e41ab26884aea
-- 2.54.0