Commit Stats
Measure AI authorship statistics for any commit or range of commits using git ai stats.
The stats command gives you AI authorship stats for a single commit, or a sequence of linear commits.
Single Commit
Show stats for the current HEAD or a specific commit:
git ai stats
git ai stats <commit-sha>Commit Ranges
Pass a range to aggregate stats across multiple commits:
git ai stats <start>..<end>To compute stats for the entire repository history, use the empty tree SHA as the start:
git ai stats 4b825dc642cb6eb9a060e54bf8d69288fbee4904..HEADStats are computed per-commit from git notes, so large ranges take proportionally longer. For repositories with thousands of commits, Git AI for Teams precomputes these aggregations and serves them from a dashboard.
JSON Output
Add --json to get machine-readable output:
git ai stats --json
git ai stats <commit-sha> --json
git ai stats <start>..<end> --jsonExample response:
{
"human_additions": 8,
"unknown_additions": 4,
"ai_additions": 81,
"ai_accepted": 81,
"git_diff_deleted_lines": 14,
"git_diff_added_lines": 93,
"tool_model_breakdown": {
"cursor::claude-4.5-opus": {
"ai_additions": 75,
"ai_accepted": 75
},
"claude-code::claude-opus-4-5-20251101": {
"ai_additions": 6,
"ai_accepted": 6
}
}
}Field descriptions:
Lines in the commit:
human_additions— Added lines attributed to a human.unknown_additions— Added lines with no attestation at all (not attributed to AI or to a known human).ai_additions— Added lines attributed to AI.ai_accepted— AI-generated lines committed without any human edits. Currently equal toai_additions.
git baseline:
git_diff_added_lines— Added lines reported by the raw git diff.git_diff_deleted_lines— Deleted lines reported by the raw git diff.
Per-tool:
tool_model_breakdown— Object keyed by<tool>::<model>, withai_additionsandai_acceptedscoped to that tool and model pair.
human_additions + unknown_additions + ai_additions always equals git_diff_added_lines — every added line is attributed to exactly one of the three.
Beyond Commits: Pull Requests, Cost, and Prompt Data
git ai stats operates on commit-level data stored in git notes. This covers authorship attribution and line counts — everything recorded locally during a coding session.
Some metrics require processing that goes beyond what git notes contain. Joining attributions on SCM metadata, computing per-PR metrics while handling squash merges and rebases, tracking token costs across models, and analyzing prompt effectiveness all depend on additional telemetry and server-side computation.
Git AI for Teams provides precomputed dashboards with per-PR metrics, model cost tracking, and prompt analysis. For guidance on which metrics to prioritize, see How to Measure AI Code.