Sparse checkouts provide a way to restrict the working tree to a subset of directories. See the git-sparse-checkout(1) manpage.
Warning: Git introduced the
git sparse-checkout command in version
2.25 and still advertises it as experimental and subject to change.
Magit’s interface should be considered the same. In particular, if
Git introduces a backward incompatible change, Magit’s sparse checkout
functionality may be updated in a way that requires a more recent Git
This transient prefix command binds the following suffix commands and displays them in a temporary buffer until a suffix is invoked.
This command initializes a sparse checkout that includes only the files in the top-level directory.
magit-sparse-checkout-add automatically initialize a sparse
checkout if necessary. However, you may want to call
magit-sparse-checkout-enable explicitly to re-initialize a sparse
checkout after calling
magit-sparse-checkout-disable, to pass
additional arguments to
git sparse-checkout init, or to execute
the initialization asynchronously.
This command takes a list of directories and configures the sparse checkout to include only files in those subdirectories. Any previously included directories are excluded unless they are in the provided list of directories.
This command is like
magit-sparse-checkout-set, but instead adds
the specified list of directories to the set of directories that is
already included in the sparse checkout.
This command applies the currently configured sparse checkout patterns to the working tree. This is useful to call if excluded files have been checked out after operations such as merging or rebasing.
This command restores the full checkout. To return to the previous
sparse checkout, call
A sparse checkout can also be initiated when cloning a repository by
magit-clone-sparse command in the
(see Cloning Repository).
If you want the status buffer to indicate when a sparse checkout is
enabled, add the function