diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2026-03-27 09:44:59 +0100 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2026-03-27 09:44:59 +0100 |
| commit | 39c1b2b07f89776c9cc3451c0ccf7b963ea1db47 (patch) | |
| tree | 63b4a35efd65c26a1f054ec3222c445181ff4406 | |
| parent | bf16422be40f9776c6c104c52ae388663e56edaf (diff) | |
magit-remote.<remote>.followremotehead: New variable setting command
Closes #5283.
| -rw-r--r-- | docs/magit.org | 15 | ||||
| -rw-r--r-- | docs/magit.texi | 26 | ||||
| -rw-r--r-- | lisp/magit-remote.el | 27 |
3 files changed, 66 insertions, 2 deletions
diff --git a/docs/magit.org b/docs/magit.org index 98ccbad..9c66f1c 100644 --- a/docs/magit.org +++ b/docs/magit.org @@ -6988,6 +6988,21 @@ These variables can be set from the transient prefix command ~--tags~, then all tags are fetched. If this variable has no value, then only tags are fetched that are reachable from fetched branches. +- Variable: remote.NAME.followRemoteHEAD :: + + How "git fetch" handles updates to "remotes/<remote>/HEAD". + + This command sets the local value of the Git variable + ~remote.<remote>.followRemoteHEAD~, where <remote> is a stand-in for + the actual remote, as displayed in the menu, from which this command + is invoked. This variable is documented in [[man:git-config]] + + Unfortunately Git does not provide a variable to set a default for + all remotes of all repositories, but you can set the global value for + a remote name used in multiple repository, which will then be used as + the default for that remote in all repositories. You should consider + using "always" for remotes named "origin". + ** Fetching Also see [[man:git-fetch]] For information about the upstream and the diff --git a/docs/magit.texi b/docs/magit.texi index f84ac94..890ce94 100644 --- a/docs/magit.texi +++ b/docs/magit.texi @@ -8290,6 +8290,32 @@ value is @code{--no-tags} then no tags are fetched. If the value is then only tags are fetched that are reachable from fetched branches. @end defvar +@defvar remote.NAME.followRemoteHEAD +How "git fetch" handles updates to "remotes/<remote>/HEAD". + +This command sets the local value of the Git variable +@code{remote.<remote>.followRemoteHEAD}, where <remote> is a stand-in for +the actual remote, as displayed in the menu, from which this command +is invoked. This variable is documented in +@ifinfo +@ref{git-config,,,gitman,}. +@end ifinfo +@ifhtml +@html +the <a href="http://git-scm.com/docs/git-config">git-config(1)</a> manpage. +@end html +@end ifhtml +@iftex +the git-config(1) manpage. +@end iftex + +Unfortunately Git does not provide a variable to set a default for +all remotes of all repositories, but you can set the global value for +a remote name used in multiple repository, which will then be used as +the default for that remote in all repositories. You should consider +using "always" for remotes named "origin". +@end defvar + @node Fetching @section Fetching diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el index 60dee8b..9fc095d 100644 --- a/lisp/magit-remote.el +++ b/lisp/magit-remote.el @@ -73,7 +73,8 @@ has to be used to view and change remote related variables." ("U" magit-remote.<remote>.fetch) ("s" magit-remote.<remote>.pushurl) ("S" magit-remote.<remote>.push) - ("O" magit-remote.<remote>.tagopt)] + ("O" magit-remote.<remote>.tagopt) + ("h" magit-remote.<remote>.followremotehead)] ["Arguments for add" ("-f" "Fetch after add" "-f")] ["Actions" @@ -316,7 +317,8 @@ refspec." ("U" magit-remote.<remote>.fetch) ("s" magit-remote.<remote>.pushurl) ("S" magit-remote.<remote>.push) - ("O" magit-remote.<remote>.tagopt)] + ("O" magit-remote.<remote>.tagopt) + ("h" magit-remote.<remote>.followremotehead)] (interactive (list (or (and (not current-prefix-arg) (not (and magit-remote-direct-configure @@ -364,6 +366,27 @@ refspec." :variable "remote.%s.tagOpt" :choices '("--no-tags" "--tags")) +(transient-define-infix magit-remote.<remote>.followremotehead () + "How \"git fetch\" handles updates to \"remotes/<remote>/HEAD\". + +This command sets the local value of the Git variable +`remote.<remote>.followRemoteHEAD', where <remote> is a stand-in for +the actual remote, as displayed in the menu, from which this command +is invoked. This variable is documented in (man \"git-config(1)\"). + +Unfortunately Git does not provide a variable to set a default for +all remotes of all repositories, but you can set the global value for +a remote name used in multiple repository, which will then be used as +the default for that remote in all repositories. You should consider +using \"always\" for remotes named \"origin\". + + git config set --global remote.origin.followRemoteHEAD always" + :class 'magit--git-variable:choices + :scope #'magit--read-remote-scope + :variable "remote.%s.followRemoteHEAD" + :choices '("create" "always" "warn") + :default "create") + ;;; Transfer Utilities (defun magit--push-remote-variable (&optional branch short) |
