Skip to main content
← back to field notes
4 min readDevelopment

Your giant repo is slow because nobody tuned git

gitadvanced-gitperformancetoolsdeveloper-experiencetutorial

If git status takes four seconds and your git client takes forty to draw the history, it's easy to blame the repository. It's big, it's old, and a few hundred people commit to it. But git has settings for exactly this problem, and most of the big repos I've worked in had never turned any of them on.

This is what I set up on every large clone, and how to tell whether it helped.

None of it needs a special tool. It's stock git, so it speeds up the terminal, your editor and any client that shells out to git.

Measure first​

Pick two commands you run all day and time them:

time git status
time git log --oneline -n 1000 > /dev/null

In PowerShell, Measure-Command { git status } does the same thing. Run each one twice and keep the second number. The first run mostly measures your disk waking up.

Write a commit-graph file​

For anything that reads history, this is the biggest single win. Without it, git walks commit objects one at a time to work out ancestry. That's fine for a thousand commits. For a million, it's miserable.

git commit-graph write --reachable
git config fetch.writeCommitGraph true

The first line builds the file. The second keeps it up to date on every fetch, so you don't have to remember. Graph views get faster, and so do git log --graph, merge-base checks and "is this branch merged?"

Turn on the file system monitor​

To answer git status, git has to find out what changed, and by default it looks at every file in the working tree. On Windows and macOS, git ships a small daemon that watches the disk and tells git what changed since last time:

git config core.fsmonitor true
git config core.untrackedCache true

The untracked cache lets git skip folders that had no new files last time. Between the two, status on a big tree drops from seconds to well under one.

The built-in monitor doesn't run on Linux. You can wire up Watchman with the sample hook git includes, or accept a slightly slower status.

There's also git config feature.manyFiles true, which turns on the untracked cache and a smaller index format in one go. It doesn't turn on the monitor, so set that separately.

Let git clean up after itself​

Large repos pile up loose objects and pack files, and each one makes lookups a bit slower. Git can tidy that on a schedule:

git maintenance start

This registers the repo with your system's scheduler: an hourly prefetch, regular commit-graph updates and incremental repacks. git maintenance unregister turns it off.

Stop downloading what you never read​

If the repo is huge because of history and assets you never touch, don't clone all of it.

A partial clone gets every commit and tree, but only downloads file contents when something needs them:

git clone --filter=blob:none https://example.com/big/repo.git

A sparse checkout keeps only the folders you work in on disk:

git sparse-checkout set services/billing libs/shared

git sparse-checkout disable brings everything back. Starting fresh? scalar clone <url> sets up a partial clone, a sparse checkout, background maintenance and the monitor in one command. Scalar has shipped with git since 2.38.

One catch with partial clones. Anything that needs old file contents, like blame on an ancient file, has to download them first. The first run is slow, and after that it's quick.

Check that it stuck​

Run your two timing commands again, then look at the settings:

git config --show-origin --get-regexp "core.fsmonitor|core.untrackedcache|fetch.writecommitgraph|feature.manyfiles"
ls .git/objects/info/commit-graph* 2>/dev/null

If status is still slow, a hook or a .gitattributes filter is probably doing work on every call. GIT_TRACE2_PERF=1 git status prints where the time went.

Then the client becomes the bottleneck​

Once git is fast, a slow client is the next thing in the way. Plenty of graphical clients read the entire history before they draw anything. That's your forty seconds.

I built Git Revenge because of that problem. It reads history in windows, just ahead of where you're scrolling, and draws the graph on a canvas. Memory grows with how far you scroll, not with the size of the repo.

On my machine, against a Linux kernel clone with 1.5 million commits and a commit-graph file, the first 100 rows were ready in 415ms. Reading the next window while scrolling averaged 1.2ms. The launch post has the full numbers and how I measured them.

It runs the git you already have, so everything above carries over. Your commit-graph file, fsmonitor and sparse checkout settings apply in the app the same way they do in a terminal. Repos that already use a partial clone or sparse checkout work as they are. There's no setup screen for those yet, so you create them with the commands above.

On a busy repo, a few other things help. Search covers the whole history, not just what's loaded, and you can search by message, author, SHA or a trailer like Closes: #12. Searching the kernel for "fix" found 251,514 matches in 156ms. Branch kinds cut the noise: mark dependabot/* as a Bot branch or gh-pages as Docs, and those lanes fold to one line per day. Blame, file history and bisect all run on your git, at your repo's actual size.

The slow parts​

Loading all 1.5 million commits and laying them out took 16.2 seconds. Jumping straight to the oldest commit from a cold start took 14.7. You won't do either often, but those are the numbers.

On Linux, watching a large tree takes one inotify watch per folder. If your limit is too low, the app says so when you open the repo, and the install guide has the two lines that raise it.

I haven't benchmarked other clients side by side, so I'm not claiming it beats them. Tune git first, then open your biggest repo in Git Revenge and in whatever you use now, and scroll both. If you write up what you find, send it my way.

field notes

you may also enjoy

more from this thread of thought

Introducing Git Revenge, and whether you should use it
Nov 5, 2026

Introducing Git Revenge, and whether you should use it

read more →
The cost of maintaining open source
Oct 27, 2026

The cost of maintaining open source

read more →
Is there a future without AI?
Oct 25, 2026

Is there a future without AI?

read more →
Introducing "Ink and Agency" a skill pack for humans (and claude)
May 18, 2026

Introducing "Ink and Agency" a skill pack for humans (and claude)

read more →
working with git: archive
Aug 5, 2025

working with git: archive

read more →
Surprise Driven Development
Jul 10, 2025

Surprise Driven Development

read more →
the field notes

recently written