Function: magit-stage-files

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

Signature

(magit-stage-files FILES &optional FORCE)

Documentation

Read one or more files and stage all changes in those files.

With prefix argument FORCE, offer ignored files for completion.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-apply.el
;;;###autoload
(defun magit-stage-files (files &optional force)
  "Read one or more files and stage all changes in those files.
With prefix argument FORCE, offer ignored files for completion."
  (interactive
    (let* ((choices (if current-prefix-arg
                        (magit-ignored-files)
                      (nconc (magit-unstaged-files)
                             (magit-untracked-files))))
           (default (or (magit-section-value-if 'file)
                        (magit-file-relative-name)))
           (default (car (member default choices))))
      (list (magit-completing-read-multiple
             (if current-prefix-arg "Stage ignored file,s: " "Stage file,s: ")
             choices nil t nil nil default)
            current-prefix-arg)))
  (magit-with-toplevel
    (magit-stage-1 (and force "--force") files)))