Skip to content

Instantly share code, notes, and snippets.

@copyleftdev
Created May 25, 2026 20:20
Show Gist options
  • Select an option

  • Save copyleftdev/11f9e928eaf05076e58896971c573621 to your computer and use it in GitHub Desktop.

Select an option

Save copyleftdev/11f9e928eaf05076e58896971c573621 to your computer and use it in GitHub Desktop.
git sparse-checkout — materialize only the paths you need
# git sparse-checkout — check out only what you need
# Monorepo with 40 packages? Only materialize the two you work in.
git sparse-checkout init --cone
git sparse-checkout set packages/auth packages/api
# Everything else vanishes from disk — still in history, just not on disk.
# Add more paths any time:
git sparse-checkout add tests
# See what's currently included:
git sparse-checkout list
# Restore everything:
git sparse-checkout disable
# ── Lean clone from the start ─────────────────────────────────
# Skip fetching file blobs you don't need yet:
git clone --filter=blob:none --sparse https://github.com/org/monorepo lean-clone
cd lean-clone
git sparse-checkout set packages/api src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment