Check Out Only Part of a Repo With sparse-checkout
Reduce a huge working tree to the directories you actually edit.
Run git sparse-checkout set src/ docs/ to keep only those paths in the working tree.
01Command
Command
$ git sparse-checkout set src/ docs/02What it does
Sparse checkout lets you clone a monorepo but materialize only a subset of paths, saving disk and IDE indexing time while keeping full history available. It is a terminal-first feature for large-scale development.
03Risk
!Warning: Files outside the sparse set appear deleted to tools that scan the filesystem; remember they still exist in the repository.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- git-sparse-checkout documentationEvidence: Documents sparse-checkout, which limits the working tree to selected paths.
Last verified: 2026-10-13 · Category: Developer