Warum sparse
Sparse Checkout fullt nur eine Teilmenge des Working Trees eines Repos, wahrend alle Metadaten und die Historie erhalten bleiben.
Cone-Modus
git sparse-checkout init --cone
git sparse-checkout set apps/web libs/shared
git sparse-checkout add apps/admin
git sparse-checkout list
Non-Cone-Modus
git sparse-checkout init
cat > .git/info/sparse-checkout <<'EOF'
/*
!/build/
!/legacy/
EOF
git read-tree -m -u HEAD
Sparse klonen
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
Index uberprufen
git ls-files -t | head
git update-index --skip-worktree path
git update-index --no-skip-worktree path
Deaktivieren
git sparse-checkout disable
Haufige Fehler
Dateien ausserhalb des Cone bearbeiten.
Sparse Index
git sparse-checkout init --cone --sparse-index
git config index.sparse true