On this page
Short answer
A large Git repository is slow for three separate reasons: too many objects to download, too many files in the working tree, and background housekeeping that never runs. Each has its own fix. Use a partial clone (--filter=blob:none) for download size, a cone-mode sparse checkout for the working tree, and git maintenance start plus the built-in file system monitor for everyday commands. Options below follow the git-scm.com reference, read 19 November 2026.
A large Git repository is slow for three separate reasons: too many objects to download, too many files in the working tree, and background housekeeping that never runs. Each has its own fix. Use a partial clone (--filter=blob:none) for download size, a cone-mode sparse checkout for the working tree, and git maintenance start plus the built-in file system monitor for everyday commands. Options below follow the git-scm.com reference, read 19 November 2026.
Which problem do you actually have?
Measure first: time git clone, time git fetch, time git status, git count-objects -vH, and git ls-files | wc -l for tracked files.
| Symptom | Likely cause | Fix | Trade-off |
|---|---|---|---|
| First clone takes minutes and uses GBs | Years of history and old binary versions | Partial clone, --filter=blob:none |
Needs the server reachable later; blobs fetched on demand |
| CI spends its time on checkout | Full history fetched for a build that needs one commit | Shallow clone, --depth=1 |
No history for log, blame, describe |
git status is slow, clone is fine |
Very many files in the working tree | Sparse checkout, git status helpers (fsmonitor, untracked cache) |
Excluded directories are not on disk |
| Fetch is slow every morning | Objects arrive only when you ask | git maintenance start (prefetch) |
Background jobs on the developer machine |
How do you set up a partial clone?
A partial clone asks the server to leave out some objects until Git needs them. The git clone reference describes it plainly: --filter=blob:none filters out all blobs (file contents) until needed, and --filter=blob:limit=<size> filters out blobs of at least that size.
- Clone with a filter:
git clone --filter=blob:none https://git.example.com/org/repo.git - For a size cut-off instead of all blobs:
git clone --filter=blob:limit=1m <url> - For history-only needs,
--filter=tree:0omits all trees and blobs (thegit rev-listreference definestree:<depth>, where depth 0 includes no trees or blobs unless named explicitly).
Omitted objects are "demand fetched" from the promisor remote, which the partial clone design document defines as the remote that promises to send missing objects when requested. That means a partial clone needs the remote to stay reachable. A first checkout of an old branch can trigger a burst of small fetches. The server has to allow it: uploadpack.allowFilter must be set for upload-pack to support object filtering, so test a filtered clone against your server before you roll it out.
When is a shallow clone the better choice?
Use a shallow clone when the job needs one commit and no history, as most build jobs do. --depth=1 creates a clone truncated to one commit and implies --single-branch unless you pass --no-single-branch. --shallow-since=<date> and --shallow-exclude=<ref> cut history by date or by a ref.
The partial clone design notes say it is independent of shallow and single-branch clones, so the two can be combined. For developers, prefer partial clone, because it keeps the full commit graph. For CI, shallow is usually enough. If a job later needs history (changelog generation, git describe), git fetch --unshallow converts a shallow repository to a complete one.
How do you clone only a subdirectory with sparse checkout?
Sparse checkout limits which files are written to the working directory. In cone mode, the default in current Git, you list directories and the working tree contains every file under them at any depth, plus the files that sit directly in their ancestor directories (so top-level files stay).
- Clone sparsely:
git clone --filter=blob:none --sparse <url>. The--sparseoption leaves only the files in the top-level directory. - Choose directories:
git sparse-checkout set services/api libs/common - Check or grow it:
git sparse-checkout list, thengit sparse-checkout add docs - Undo:
git sparse-checkout disable
Combined with --filter=blob:none, blobs for unselected directories are not downloaded. The docs advise against non-cone mode (--no-cone), which takes a pattern list and does not work with some options such as --sparse-index. A sparse index (--sparse-index, off by default) shrinks the index to match the sparse definition and can speed up git status and git add, but it is marked experimental, and older Git versions and some external tools do not understand it. If a tool breaks, git sparse-checkout init --no-sparse-index rewrites the index back.
What does git maintenance do for you?
git maintenance start registers the repository and schedules background runs. The docs say the scheduler runs git maintenance run --scheduled hourly, and register sets maintenance.strategy to incremental if it is unset. The incremental schedule is:
| Task | Schedule | What it does |
|---|---|---|
commit-graph |
Hourly | Updates commit-graph files incrementally |
prefetch |
Hourly | Runs git fetch for each remote into refs/prefetch/, so a real fetch needs little transfer |
loose-objects |
Daily | Packs loose objects into a new pack |
incremental-repack |
Daily | Repacks the object directory without a full rewrite |
gc |
Disabled | Replaced by the tasks above; the docs advise against enabling both gc and loose-objects |
Prefetch does not update tags or remote-tracking branches, so nothing moves under your feet. Exclude a remote with remote.<name>.skipFetchAll; stop the schedule with git maintenance stop.
Which config settings help `git status` on a big tree?
core.fsmonitor=trueenables the built-in file system monitor daemon sogit statusneed not scan every file. It is available only on Windows and macOS. If you mix Git versions (a CLI and an IDE), note that versions 2.35.1 and earlier do not understand the boolean and treattrueas a hook path.core.untrackedCache=truecaches untracked-file scans. It assumesmtimeworks on your filesystem, so check that before enabling it.feature.manyFiles=trueturns onindex.version=4and the untracked cache, and setsindex.skipHash=true. The docs warn that Git older than 2.40.0 reports a corrupted index duringgit fsckwith skipHash, and Git older than 2.13.0 refuses to parse the index.
Where do these fixes fail?
- Offline work on a partial clone. Missing blobs cannot be fetched. Pre-fetch what you need before travel with a normal checkout of that path.
- Servers without filter support. Check
uploadpack.allowFilteron self-managed servers, and test a filtered clone before announcing it to teams. - Mixed Git versions. Pin the Git version in CI images;
skipHash, fsmonitor and sparse index each have version caveats above. - Submodules. The filter is not applied to them unless you pass
--also-filter-submoduleswith--recurse-submodules.
For teams that want a second pair of hands, Git consulting from AceMQ includes large-repository performance work; the scope is described in the clone-performance assessment. If the real pain is the CI side, see Jenkins alternatives and when to stay on Jenkins.
FAQ
What is the difference between a shallow clone and a partial clone? A shallow clone cuts history (fewer commits). A partial clone keeps all commits but omits some file contents or trees until needed. They solve different problems and can be combined.
Does git sparse-checkout make clones faster by itself?
No. It limits files on disk. To avoid downloading the excluded content, combine it with --filter=blob:none.
Should I run git gc on a large repository?
The incremental maintenance strategy disables gc and uses smaller scheduled tasks instead. Run git gc by hand only when you have a reason.
Sources
Talk to an engineer
Need a hand with Git?
Senior engineers who run it in production. Get a quote or a free consultation, no sales pitch.

