Function: magit-file-stage

magit-file-stage is an autoloaded, interactive and byte-compiled function defined in magit-files.el.

Signature

(magit-file-stage)

Documentation

Stage all changes to the file being visited in the current buffer.

Key Bindings

Aliases

magit-stage-buffer-file (obsolete since Magit 4.3.2)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-files.el
;;; File Commands

;;;###autoload
(defun magit-file-stage ()
  "Stage all changes to the file being visited in the current buffer."
  (interactive)
  (unless buffer-file-name
    (user-error "Not visiting a file"))
  (magit-with-toplevel
    (magit-stage-1 (and (magit-file-ignored-p buffer-file-name)
                        (if (y-or-n-p "Visited file is ignored; stage anyway?")
                            "--force"
                          (user-error "Abort")))
                   (list (magit-file-relative-name)))))