Function: magit-stage-files

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

magit-mode-map s

Source Code

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