A 2026 empirical study of 128,018 GitHub repositories (arXiv:2601.18341) measured how autonomous coding agents like Cursor, Claude Code, and Codex change real version control histories. Adoption across active repositories already sits between 22.20% and 28.66%, yet the sharpest operational shift appears at code review time.
Commits assisted by coding agents add a median of 31 lines of code, triple the 11-line median of human-authored commits and nearly eight times the 4-line median of automated dependency bots. At the 75th percentile, agent-assisted additions reach 114 lines compared to 41 lines for humans.
When an agent bundles import cleanup, type renames, and core business logic into one large patch, human reviewers start skimming. Here is what the repository data shows and how to enforce small, single-intent commits locally before opening a pull request.
What the 128,018-repository dataset shows
The size gap widens at the tails of the commit distribution:
- Small surgical commits (1 to 5 added lines) drop by 36% when a coding agent assists with the change.
- Massive commits adding more than 1,000 lines occur almost twice as frequently in agent-assisted histories.
- Single-file commits drop by roughly 15%, while commits touching more than 20 files jump by 30%.
- Median deletions also climb from 5 lines in human commits to 7 lines in agent-assisted commits, increasing cross-file code churn.
Agents optimize for task completion inside a single prompt loop. Ask an agent to fix a pagination bug, and it will often reformat untouched helpers, rename local variables, and update test fixtures in the same working tree. Staging everything at once turns a 15-line bug fix into a 14-file review bottleneck.
Inspecting staged churn before you commit
Before running git commit after an agent session, inspect file-level churn across the index with --numstat and --shortstat:
git diff --cached --numstat
git diff --cached --shortstat
A mixed agent session typically produces an uneven spread like this:
4 4 src/api/client.ts
2 2 src/utils/date.ts
68 59 src/components/table.tsx
19 3 src/services/pagination.ts
34 0 tests/pagination.test.ts
5 files changed, 127 insertions(+), 68 deletions(-)
Only src/services/pagination.ts and tests/pagination.test.ts implement the actual fix. The remaining 139 modified lines in table.tsx, client.ts, and date.ts are formatting and cleanup noise that obscure the behavioral change.
Step 1: Separate mechanical edits from behavior changes
Reset the index and stage hunks selectively so mechanical cleanup never shares a commit hash with behavioral logic:
# Unstage all agent edits while keeping working tree changes intact
git reset
# Commit 1: stage mechanical formatting or renames only
git add src/api/client.ts src/utils/date.ts src/components/table.tsx
git commit -m "refactor: normalize table formatting and imports"
# Commit 2: interactively verify and stage logic hunks plus tests
git add --patch src/services/pagination.ts tests/pagination.test.ts
git commit -m "fix: handle empty cursor boundary in pagination"
Reviewers can now verify the 22-line pagination fix: commit in seconds and inspect the mechanical cleanup commit separately without hunting for hidden logic mutations.
Step 2: Add a local pre-commit diff budget hook
Prompt rules alone drift during long coding sessions. A lightweight .git/hooks/pre-commit script enforces a hard ceiling on file count and line churn before a commit is recorded:
#!/usr/bin/env bash
set -euo pipefail
max_files=10
max_lines=300
files_changed=$(git diff --cached --numstat | wc -l | tr -d ' ')
lines_changed=$(git diff --cached --numstat | awk '{ sum += $1 + $2 } END { print sum + 0 }')
if [ "$files_changed" -gt "$max_files" ] || [ "$lines_changed" -gt "$max_lines" ]; then
echo "Commit blocked: $files_changed files and $lines_changed changed lines exceed budget ($max_files files / $max_lines lines)." >&2
echo "Split mechanical cleanup from feat: or fix: logic using git reset and git add --patch." >&2
exit 1
fi
Make the hook executable in your repository:
chmod +x .git/hooks/pre-commit
When an unbounded agent run attempts to bundle 14 files and 418 changed lines into one commit, Git stops the commit immediately:
Commit blocked: 14 files and 418 changed lines exceed budget (10 files / 300 lines).
Split mechanical cleanup from feat: or fix: logic using git reset and git add --patch.
Splitting the working tree into a cleanup commit and a focused logic commit brings both diffs well below the threshold and keeps git bisect reliable when tracking down regressions later.
Summary checklist
- Check staged file spread with
git diff --cached --numstatafter every autonomous agent run. - Keep formatting, file moves, and import cleanup in a standalone preparatory commit.
- Stage behavioral
feat:andfix:changes alongside their tests usinggit add --patch. - Enforce a local
.git/hooks/pre-commitline and file budget so oversized multi-intent diffs never reach pull request review.
Top comments (8)
Larger commits from agents make sense, they don't feel the pain of a messy diff the way a reviewer does. Asking the agent to commit after each passing test, and keeping refactors in their own commits, seems to help reviewers the most.
Explicit file staging helps there too, since agents still tuck unrelated helper renames into a passing-test commit when staging the whole tree at once. Scoping git add by path keeps each checkpoint focused on the actual behavior change.
Good point, scoping git add per file is the simplest fix for that. A passing test can hide an unrelated rename in the same commit, and explicit staging makes the agent say what it meant to change.
Splitting mechanical commits from behavior commits helps whoever checks the work against the story too. I'd ask each fix: commit to name the acceptance criterion it changes. Then a commit that touches behavior but names no criterion is either scope creep or a missing requirement, and either way it's a question before merge, not after.
Generic commit messages like "fix validation" often mask speculative fallback logic or extra cleanup tucked inside a coding-agent diff. Asking each behavior commit to name the exact acceptance criterion it satisfies forces unmapped edits into the open right away.
Once a change sits outside every listed criterion, you know immediately whether to drop the extra hunk or open a ticket for an undocumented edge case before merge.
The 31 vs 11 lines number stuck with me because it's exactly what I've been seeing — the actual fix is maybe 20 lines and then there's a pile of import cleanup and formatting around it that makes the diff look scary for no reason. The pre-commit budget is the part I'll actually try, 10 files / 300 lines feels strict enough to force a split without me just turning it off after a day. My only worry is a legit big refactor tripping it all the time, do you just bump the numbers for those or split anyway?
Most large refactors still split cleanly into two phases without raising the 10-file limit: move shared types or module renames first, then migrate callers a slice at a time. Each checkpoint stays fast to verify and leaves automated formatting noise outside the behavioral change.
For single-shot changes that truly cannot be sliced, like a database migration or generated schema update, gating the hook with a one-off skip environment variable beats raising the budget globally. Once people raise the threshold past 300 lines, they rarely turn it back down.
The 31 vs 11 median lines up with what I've seen too — the fix itself is usually small, and the rest is the agent tidying things it touched along the way. The pre-commit budget is the part I'd steal first: a hard 10-file/300-line ceiling beats asking the agent nicely to keep things small. Have you tried checking the staged spread mid-session, after each agent turn, or do you only catch it at commit time?