Appearance
git commit-graph quick reference
One-line commands for commit-graph performance optimization in DevOps.
Write the graph
bash
git commit-graph write --reachable --changed-paths # full write with Bloom filter
git commit-graph write --reachable --changed-paths --split # incremental writeEnable auto-write
bash
git config gc.writeCommitGraph true # write during gc
git config fetch.writeCommitGraph true # write during fetch
git config --global gc.writeCommitGraph true # global defaultVerify and inspect
bash
git commit-graph verify # integrity check
git commit-graph verify --no-progress --stats 2>&1 # show stats
git commit-graph verify --no-progress 2>&1 | grep -i bloom # check Bloom filter
ls -la .git/objects/info/commit-graphs/ # list layers
cat .git/objects/info/commit-graphs/commit-graph-chain # chain orderMaintenance schedule
bash
git maintenance start # register hourly/daily/weekly
git maintenance run --task=commit-graph # run commit-graph task nowCI one-liners
bash
# Pre-warm graph after clone (long-lived runners)
git clone --filter=blob:none https://git.internal/repo.git .
git commit-graph write --reachable --changed-paths
# Fetch-time graph building (frequent fetch pipelines)
git config fetch.writeCommitGraph true
# Bloom filter for path scoping
git log --oneline HEAD~5..HEAD -- "services/auth/" | head -1 | grep -q .
# Conditional graph write for large repos
test -f .git/objects/info/commit-graph || \
git rev-list --count HEAD | xargs -I{} bash -c \
'if [ {} -gt 10000 ]; then git commit-graph write --reachable --changed-paths; fi'
# Consolidate incremental chain
git commit-graph write --reachable --changed-pathsConfig keys
ini
[gc]
writeCommitGraph = true
[fetch]
writeCommitGraph = true
[commitGraph]
maxNewFilters = 64Performance gain
| Operation | Before | After |
|---|---|---|
git merge-base HEAD origin/main | 1.8s | 0.05s |
git log --all -- Makefile | 45s | 0.8s |
git log --graph --all -100 | 4.2s | 0.3s |
See also
docs/devops-workflows/git-commit-graph.md— full guidedocs/devops-workflows/git-maintenance.md— background maintenancescripts/commit-graph-manage.sh— automation script