Function: magit-sparse-checkout-add

magit-sparse-checkout-add is an autoloaded, interactive and byte-compiled function defined in magit-sparse-checkout.el.

Signature

(magit-sparse-checkout-add DIRECTORIES)

Documentation

Add DIRECTORIES to the working tree.

To override rather than extend the currently configured directories, call magit-sparse-checkout-set instead.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-sparse-checkout.el
;;;###autoload
(defun magit-sparse-checkout-add (directories)
  "Add DIRECTORIES to the working tree.
To override rather than extend the currently configured
directories, call `magit-sparse-checkout-set' instead."
  (interactive
    (list (magit-completing-read-multiple
           "Add these directories: "
           ;; Same performance note as in `magit-sparse-checkout-set',
           ;; but even more so given the additional processing.
           (seq-remove
            (let ((re (concat
                       "\\`"
                       (regexp-opt (magit-sparse-checkout-directories)))))
              (##string-match-p re %))
            (magit-revision-directories "HEAD")))))
  (magit-sparse-checkout--auto-enable)
  (magit-run-git-async "sparse-checkout" "add" directories))