Created
May 25, 2026 20:20
-
-
Save copyleftdev/11f9e928eaf05076e58896971c573621 to your computer and use it in GitHub Desktop.
git sparse-checkout — materialize only the paths you need
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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