Progress:
TIER 3 · MODULE 03· Expert

git commit-graph

Massive log/walk speedup. Modern repos all want this.

🎯 What & why

git commit-graph builds and maintains the commit-graph file — an auxiliary index of commit metadata that makes git log, --graph, reachability queries, and ancestry checks dramatically faster on large repos.

🧠 Mental model

A cache file at .git/objects/info/commit-graph (or under commit-graphs/ when split). It stores parent pointers, commit times, generation numbers, and optionally changed-path Bloom filters — all derived from existing commit objects. Refs and the object DB are unchanged; this is pure read-side acceleration. Auto-written by git maintenance and gc.writeCommitGraph=true.

🛠️ Synopsis

git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]
git commit-graph write  [--object-dir <dir>] [--append|--split[=<strategy>]]
                        [--reachable | --stdin-packs | --stdin-commits]
                        [--changed-paths] [--max-new-filters=<n>] [--[no-]progress]

🎚️ Switches & options

FlagWhat it does
--reachableWalk every ref to discover commits. Most common; produces a full graph.
--stdin-packsRead pack-index filenames from stdin and include only commits in those packs.
--stdin-commitsRead commit OIDs from stdin and include only those (and optionally their ancestors).
--changed-pathsAlso compute Bloom filters of changed file paths — speeds up git log -- <path> enormously.
--split[=<strategy>]Write an incremental layered graph instead of one monolithic file. Strategies: no-merge, replace.
--appendAppend new commits to the existing graph rather than rewriting from scratch.
--object-dir <dir>Operate on the graph in <dir>/info/ instead of the default object directory.

📦 Subcommands

verify — Sanity-check an existing commit-graph file; exits non-zero on corruption.
git commit-graph verify
write — Build or update the commit-graph file from reachable commits or supplied input.
git commit-graph write --reachable --changed-paths
read — (Debug) Dump the parsed contents of the current commit-graph file.
git commit-graph read

💡 Use cases

🧪 Examples

Build a full graph from all refs
git commit-graph write --reachable
Add Bloom filters for path queries
git commit-graph write --reachable --changed-paths
Incremental split write
git commit-graph write --reachable --split
Verify integrity
git commit-graph verify

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.