Function: magit--get-default-branch
magit--get-default-branch is a byte-compiled function defined in
magit-git.el.
Signature
(magit--get-default-branch &optional UPDATE)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit--get-default-branch (&optional update)
(let ((remote (magit-primary-remote)))
(when update
(if (not remote)
(user-error "Cannot determine primary remote")
(message "Determining default branch...")
(magit-git "fetch" "--prune")
(magit-git "remote" "set-head" "--auto" remote)
(message "Determining default branch...done")))
(let ((branch (magit-git-string "symbolic-ref" "--short"
(format "refs/remotes/%s/HEAD" remote))))
(when (and update (not branch))
(error "Cannot determine new default branch"))
(list remote (and branch (cdr (magit-split-branch-name branch)))))))