Function: magit-file-stage

magit-file-stage is an interactive and natively 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

This command is not in any keymaps.

Aliases

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

Source Code

;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/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)))))