Da Anonimo (non verificato) , 29 Aprile 2026

Perche sparse

Il sparse checkout popola solo un sottoinsieme del working tree di un repo, mantenendo tutti i metadati e la storia. Per i monorepo, puo significare estrarre l'1% dei file e ignorare il restante 99%.

Modalita cone

git sparse-checkout init --cone
git sparse-checkout set apps/web libs/shared
git sparse-checkout add apps/admin
git sparse-checkout list

Modalita non-cone

git sparse-checkout init
cat > .git/info/sparse-checkout <<'EOF'
/*
!/build/
!/legacy/
EOF
git read-tree -m -u HEAD

Clonare 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

Verificare l'index

git ls-files -t | head
git update-index --skip-worktree path
git update-index --no-skip-worktree path

Disabilitare

git sparse-checkout disable

Errori comuni

Modificare file fuori dal cone. Usare la modalita cone a meno che i pattern non lo richiedano davvero.

Sparse index

git sparse-checkout init --cone --sparse-index
git config index.sparse true