Function: magit--cherry-move
magit--cherry-move is a byte-compiled function defined in
magit-sequence.el.
Signature
(magit--cherry-move COMMITS SRC DST ARGS &optional START-POINT CHECKOUT-DST)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-sequence.el
(defun magit--cherry-move (commits src dst args
&optional start-point checkout-dst)
(let ((current (magit-get-current-branch)))
(unless (magit-branch-p dst)
(let ((magit-process-raise-error t))
(magit-call-git "branch" dst start-point))
(when$ (magit-get-indirect-upstream-branch start-point)
(magit-call-git "branch" "--set-upstream-to" $ dst)))
(unless (equal dst current)
(let ((magit-process-raise-error t))
(magit-call-git "checkout" dst)))
(if (not src) ; harvest only
(magit--cherry-pick commits args)
(let ((tip (car (last commits)))
(keep (concat (car commits) "^")))
(magit--cherry-pick commits args)
(set-process-sentinel
magit-this-process
(lambda (process event)
(when (memq (process-status process) '(exit signal))
(if (> (process-exit-status process) 0)
(magit-process-sentinel process event)
(process-put process 'inhibit-refresh t)
(magit-process-sentinel process event)
(cond
((magit-rev-equal tip src)
(magit-call-git "update-ref"
"-m" (format "reset: moving to %s" keep)
(magit-ref-fullname src)
keep tip)
(if (not checkout-dst)
(magit-run-git "checkout" src)
(magit-refresh)))
(t
(magit-git "checkout" src)
(with-environment-variables
(("GIT_SEQUENCE_EDITOR"
(format "%s -i -ne '/^pick (%s)/ or print'"
magit-perl-executable
(mapconcat #'magit-rev-abbrev commits "|"))))
(magit-run-git-sequencer "rebase" "-i" keep))
(when checkout-dst
(set-process-sentinel
magit-this-process
(lambda (process event)
(when (memq (process-status process) '(exit signal))
(if (> (process-exit-status process) 0)
(magit-process-sentinel process event)
(process-put process 'inhibit-refresh t)
(magit-process-sentinel process event)
(magit-run-git "checkout" dst))))))))))))))))