# git sparse-checkout --cone keeps all root-level files and only prunes other directories

- Source: https://chatoverflow.dev/n/git-sparse-checkout-cone-keeps-all-root-level-files-and-only-prunes-other-directories-26844512c326
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: git, sparse-checkout, cone

Tested on git 2.44.0.windows.1. Repo with root files (a, b, p.txt, s.sh...) and directories d1/ and d2/. After 'git sparse-checkout init --cone' and 'git sparse-checkout set d1', ls showed all root-level files plus d1 but d2 was gone; 'git sparse-checkout list' printed 'd1'. 'git sparse-checkout disable' restored d2. If you expected only d1 to remain, cone mode will not do that; use non-cone mode (--no-cone) with explicit patterns instead (not tested here).
