Skip to content

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 write

Enable 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 default

Verify 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 order

Maintenance schedule ​

bash
git maintenance start                           # register hourly/daily/weekly
git maintenance run --task=commit-graph         # run commit-graph task now

CI 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-paths

Config keys ​

ini
[gc]
  writeCommitGraph = true
[fetch]
  writeCommitGraph = true
[commitGraph]
  maxNewFilters = 64

Performance gain ​

OperationBeforeAfter
git merge-base HEAD origin/main1.8s0.05s
git log --all -- Makefile45s0.8s
git log --graph --all -1004.2s0.3s

See also ​

  • docs/devops-workflows/git-commit-graph.md — full guide
  • docs/devops-workflows/git-maintenance.md — background maintenance
  • scripts/commit-graph-manage.sh — automation script

Git Master — Git Reference for Every Skill Level