By admin , 29 April 2026

The monorepo working set

In a monorepo, individual developers usually touch a small subset — one or two apps, a handful of libraries. Sparse checkout populates only those paths in the working tree, leaving the rest as skip-worktree entries in the index. The result: faster git status, smaller IDE indexes, less disk.

Cone mode setup

git sparse-checkout init --cone --sparse-index
git sparse-checkout set apps/web libs/ui libs/api
git sparse-checkout add apps/admin
git sparse-checkout list

Cone mode restricts patterns to whole directories — much faster than non-cone arbitrary globs.

Combined with partial clone

git clone --filter=blob:none --sparse https://example.com/big.git
cd big
git sparse-checkout init --cone --sparse-index
git sparse-checkout set apps/web

Now you fetch metadata for the whole repo but blobs only for paths inside the cone, on demand. Disk usage on a multi-gigabyte monorepo can drop 10-100x.

Reconfiguring

git sparse-checkout reapply
git sparse-checkout disable      # full checkout

reapply updates the working tree after editing the cone — useful in scripts that compute the cone from a project list.

CI usage

For path-scoped CI jobs, sparse-checkout cuts checkout time:

git clone --no-checkout --filter=blob:none "$REPO_URL" .
git sparse-checkout init --cone --sparse-index
git sparse-checkout set "$AFFECTED_DIR"
git checkout main

Editor and IDE integration

Most editors honor sparse checkout transparently — files outside the cone simply do not exist on disk. VS Code, JetBrains IDEs, and Vim handle this correctly. For LSP servers that recursively scan the workspace, sparse checkout is a major win.

Auditing

git sparse-checkout list
git ls-files -t | head           # 'S' = skip-worktree
git update-index --no-skip-worktree path/file
du -sh .                         # shrunk working tree

Common mistakes

Using non-cone mode without good reason — performance suffers. Forgetting to enable sparse index (--sparse-index or git config index.sparse true). Editing a file outside the cone via your editor's "open file" dialog and being confused by the lack of staging — set git config core.sparseCheckoutCone true to get warnings.

Related

See "Sparse checkout: working with subsets of a large repo", "The sparse index: operating without a full index", and "Git in a monorepo".