Function: magit-update-default-branch
magit-update-default-branch is an autoloaded, interactive and
byte-compiled function defined in magit-remote.el.
Signature
(magit-update-default-branch)
Documentation
Update name of the default branch after upstream changed it.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-remote.el
;;;###autoload(autoload 'magit-update-default-branch "magit-remote" nil t)
(transient-define-suffix magit-update-default-branch ()
"Update name of the default branch after upstream changed it."
:description "Update default branch"
:inapt-if-not #'magit-get-some-remote
(interactive)
(pcase-let ((`(,_remote ,oldname) (magit--get-default-branch))
(`( ,remote ,newname) (magit--get-default-branch t)))
(cond
((equal oldname newname)
(setq oldname
(read-string
(format
"Name of default branch is still `%s', %s\n%s `%s': " oldname
"but the upstreams of some local branches might need updating."
"Name of upstream branches to replace with" newname)))
(magit--set-default-branch newname oldname)
(magit-refresh))
(t
(unless oldname
(setq oldname
(magit-read-other-local-branch
(format "Name of old default branch to be renamed to `%s'"
newname)
newname "master")))
(cond
((y-or-n-p (format "Default branch changed from `%s' to `%s' on %s.%s?"
oldname newname remote " Do the same locally"))
(magit--set-default-branch newname oldname)
(magit-refresh))
((user-error "Abort")))))))