Variable: magit-branch-rename-push-target
magit-branch-rename-push-target is a customizable variable defined in
magit-branch.el.
Value
t
Documentation
Whether the push-remote setup is preserved when renaming a branch.
The command magit-branch-rename renames a branch named OLD to
NEW. This option controls how much of the push-remote setup is
preserved when doing so.
When nil, then preserve nothing and unset branch.OLD.pushRemote.
When local-only, then first set branch.NEW.pushRemote to the
same value as branch.OLD.pushRemote, provided the latter is
actually set and unless the former already has another value.
When t, then rename the branch named OLD on the remote specified
by branch.OLD.pushRemote to NEW, provided OLD exists on that
remote and unless NEW already exists on the remote.
When forge-only and the forge package is available, then
behave like t if the remote points to a repository on a forge
(currently Github or Gitlab), otherwise like local-only.
This variable was added, or its default value changed, in magit version 2.90.0.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-branch.el
(defcustom magit-branch-rename-push-target t
"Whether the push-remote setup is preserved when renaming a branch.
The command `magit-branch-rename' renames a branch named OLD to
NEW. This option controls how much of the push-remote setup is
preserved when doing so.
When nil, then preserve nothing and unset `branch.OLD.pushRemote'.
When `local-only', then first set `branch.NEW.pushRemote' to the
same value as `branch.OLD.pushRemote', provided the latter is
actually set and unless the former already has another value.
When t, then rename the branch named OLD on the remote specified
by `branch.OLD.pushRemote' to NEW, provided OLD exists on that
remote and unless NEW already exists on the remote.
When `forge-only' and the `forge' package is available, then
behave like `t' if the remote points to a repository on a forge
(currently Github or Gitlab), otherwise like `local-only'."
:package-version '(magit . "2.90.0")
:group 'magit-commands
:type '(choice
(const :tag "Don't preserve push-remote setup" nil)
(const :tag "Preserve push-remote setup" local-only)
(const :tag "... and rename corresponding branch on remote" t)
(const :tag "... but only if remote is on a forge" forge-only)))