All docs

Check out fewer folders in a large repository

Use cone-mode sparse checkout to work with the directories you need and preview changes before applying them.

Choose the directories you need

Enable Sparse Checkout in Settings → Advanced features if needed, then open Sparse Checkout on the branch bar. Suppose the repo contains these files:

README.md
apps/package.json
apps/web/src/index.ts
apps/mobile/src/index.ts

Selecting apps/web in cone mode keeps the files in that directory and its subdirectories. Git also keeps files directly under its leading directories, so README.md and apps/package.json are present. The apps/mobile directory is outside the selection.

Read and apply the preview

Check which directories the preview adds and removes. Commit or stash tracked edits in affected locations before applying. Check the preview's guidance for untracked paths. After applying, verify that the selected folders and expected supporting files are on disk. The branch history still records the full project.

Sparse checkout preview showing file counts and enable action
Review the file counts and warnings before applying the selected folders. Open full-size image

Reapply or return to a full checkout

Use Reapply when the existing rules should run again, such as after a merge temporarily brought other files into the checkout. Use Disable… to restore the full checkout and review what will be restored before confirming.

Git sparse-checkout reference

More docs