Cloning huge repo when you only need one folder wastes time and disk. Sparse checkout downloads only what you need.
Clone with Sparse Checkout:
# Clone repository (no files yet) git clone --no-checkout https://github.com/user/repo.git cd repo # Enable sparse checkout git sparse-checkout init --cone # Specify folders you want git sparse-checkout set frontend/src backend/api # Checkout (only specified folders downloaded) git checkout main
Result:
Full repo: 5 GB, 100,000 files
Your clone: 500 MB, 10,000 files
= 10x less!
Add More Folders Later:
git sparse-checkout add docs
See Current Sparse Checkout:
git sparse-checkout list
Essential for monorepos!
