Function: magit-rebase-onto-upstream

magit-rebase-onto-upstream is an interactive and natively compiled function defined in magit-sequence.el.

Signature

(magit-rebase-onto-upstream ARG1)

Documentation

Rebase the current branch onto its upstream branch.

With a prefix argument or when the upstream is either not configured or unusable, then let the user first configure the upstream.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/magit-sequence.el
;;;###autoload(autoload 'magit-rebase-onto-upstream "magit-sequence" nil t)
(transient-define-suffix magit-rebase-onto-upstream (args)
  "Rebase the current branch onto its upstream branch.

With a prefix argument or when the upstream is either not
configured or unusable, then let the user first configure
the upstream."
  :if #'magit-get-current-branch
  :description #'magit-rebase--upstream-description
  (interactive (list (magit-rebase-arguments)))
  (let* ((branch (or (magit-get-current-branch)
                     (user-error "No branch is checked out")))
         (upstream (magit-get-upstream-branch branch)))
    (when (or current-prefix-arg (not upstream))
      (setq upstream
            (magit-read-upstream-branch
             branch (format "Set upstream of %s and rebase onto that" branch)))
      (magit-set-upstream-branch branch upstream))
    (magit-git-rebase upstream args)))