Function: magit-apply
magit-apply is an interactive and natively 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
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-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))
(`(rebase-sequence file)
(call-interactively #'magit-patch-apply))
(`(,_ region) (magit-apply-region $ args))
(`(,_ hunk) (magit-apply-hunk $ args))
(`(,_ hunks) (magit-apply-hunks $ args))
(`(,_ file) (magit-apply-diff $ args))
(`(,_ files) (magit-apply-diffs $ args)))))