Function: magit-apply
magit-apply is an interactive and byte-compiled function defined in
magit-apply.el.
Signature
(magit-apply &rest ARGS)
Documentation
Apply the change at point to the working tree.
With a prefix argument fallback to a 3-way merge. Doing so causes the change to be applied to the index as well.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-apply.el
;;; Commands
;;;; Apply
(defun magit-apply (&rest args)
"Apply the change at point to the working tree.
With a prefix argument fallback to a 3-way merge. Doing
so causes the change to be applied to the index as well."
(interactive (and current-prefix-arg (list "--3way")))
(when$ (magit-apply--get-selection)
(pcase (list (magit-diff-type) (magit-diff-scope))
(`(,(or 'unstaged 'staged) ,_)
(user-error "Change is already in the working tree"))
(`(untracked ,(or 'file 'files))
(call-interactively #'magit-am))
(`(,_ region) (magit-apply-region $ args))
(`(,_ hunk) (magit-apply-hunk $ args))
(`(,_ hunks) (magit-apply-hunks $ args))
(`(rebase-sequence file)
(call-interactively #'magit-patch-apply))
(`(,_ file) (magit-apply-diff $ args))
(`(,_ files) (magit-apply-diffs $ args)))))