Function: magit-patch-apply

magit-patch-apply is an autoloaded, interactive and byte-compiled function defined in magit-patch.el.

Signature

(magit-patch-apply ARG1 &rest REST)

Documentation

Apply the patch file FILE.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-patch.el
;;;###autoload(autoload 'magit-patch-apply "magit-patch" nil t)
(transient-define-prefix magit-patch-apply (file &rest args)
  "Apply the patch file FILE."
  :man-page "git-apply"
  ["Arguments"
   ("-i" "Also apply to index" "--index")
   ("-c" "Only apply to index" "--cached")
   ("-3" "Fall back on 3way merge" ("-3" "--3way"))]
  ["Actions"
   ("a"  "Apply patch" magit-patch-apply)]
  (interactive
    (if (not (eq transient-current-command 'magit-patch-apply))
        (list nil)
      (list (expand-file-name
             (read-file-name "Apply patch: "
                             default-directory nil nil
                             (and$ (magit-file-at-point)
                                   (file-relative-name $))))
            (transient-args 'magit-patch-apply))))
  (if (not file)
      (transient-setup 'magit-patch-apply)
    (magit-run-git "apply" args "--" (magit-convert-filename-for-git file))))