Por qué sparse
Sparse checkout puebla solo un subconjunto del árbol de trabajo de un repo, conservando todos los metadatos e historia. Para monorepos, esto puede significar hacer checkout del 1% de los archivos e ignorar el otro 99%, acelerando dramáticamente git status, indexación de IDE y uso de disco.
Modo cono
git sparse-checkout init --cone
git sparse-checkout set apps/web libs/shared
git sparse-checkout add apps/admin
git sparse-checkout list
Modo no-cono
git sparse-checkout init
cat > .git/info/sparse-checkout <<'EOF'
/*
!/build/
!/legacy/
EOF
git read-tree -m -u HEAD
Clonar sparse
git clone --filter=blob:none --no-checkout https://example.com/big.git
cd big
git sparse-checkout init --cone
git sparse-checkout set apps/web
git checkout main
Verificar el índice
git ls-files -t | head
git update-index --skip-worktree path
git update-index --no-skip-worktree path
Deshabilitar
git sparse-checkout disable
Errores comunes
Editar archivos fuera del cono. Usa modo cono a menos que los patrones realmente lo requieran.
Sparse index
git sparse-checkout init --cone --sparse-index
git config index.sparse true