Function: forge-set-default-branch

forge-set-default-branch is an interactive and natively compiled function defined in forge-commands.el.

Signature

(forge-set-default-branch)

Documentation

Change the default branch on the upstream remote and locally.

Also update the upstream branches of local branches accordingly.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/923zwib42c4qw6x4xps0cv1wi8qcd6lp-emacs-packages-deps/share/emacs/site-lisp/elpa/forge-20261005.753/forge-commands.el
;;;###autoload
(defun forge-set-default-branch ()
  "Change the default branch on the upstream remote and locally.
Also update the upstream branches of local branches accordingly."
  (interactive)
  (pcase-let* ((`(,repo ,old) (forge--set-default-branch-read-args))
               (new (magit-read-remote-branch
                     (format "Set default branch (was: %s)" old)
                     (delete old (forge--get-remote))
                     nil nil t)))
    (message "Changing default branch...")
    (forge--set-default-branch repo new)
    (magit--set-default-branch new old)
    (forge-refresh-buffer)
    (message "Changing default branch...done")))