{"slug": "what-happens-when-an-ai-agent-commits-to-your-repo", "title": "What happens when an AI agent commits to your repo", "summary": "A developer's analysis of Git histories reveals that AI coding assistants amplify existing developer habits, producing either vague, large commits or small, well-structured ones depending on the user's skill level. The post warns that AI removes the friction that previously limited bad commit practices, making it effortless for teams to generate commit histories that cannot be bisected, reverted, or understood by future developers. Senior developers mitigate this by breaking work into per-commit prompts, reviewing AI output for missing edge cases, and rewriting commit messages by hand to explain rationale rather than just changes.", "body_md": "A few weeks ago, I argued that AI is not a great equalizer — it's a great amplifier. It amplifies what developers already are, for better and for worse. Juniors with AI produce junior code at senior speed. Seniors with AI produce senior code at supernatural speed.\n\nThis post is about where that amplification becomes visible: your Git history.\n\nEvery team that's adopted AI coding assistants — Claude Code, Cursor, GitHub Copilot, Windsurf — has introduced a new kind of contributor to their repo. Sometimes it's tagged explicitly (`co-authored-by: claude`\n\n). Sometimes it's invisible. Either way, the commits AI produces (or AI-assisted developers produce) look different, and Git reveals the difference within weeks.\n\nHere's what to watch for, and why the fundamentals of Git practice matter more now than ever.\n\nOpen any repository that's been using AI assistance for a few months and run this:\n\n```\ngit log --oneline --since=\"3 months ago\" | head -50\n```\n\nYou'll see two patterns emerge.\n\n*Pattern A — the junior-amplified commit:*\n\n```\na7f3c21 fix stuff\n9e2b8f4 more changes\n12a4e5c update\n8d1f90b fix tests\nf5a23de wip\n```\n\nLarge commits, vague messages, no clear scope. The developer asked AI \"fix this bug\" and committed whatever AI produced. A month later, nobody knows what any of these commits actually do.\n\n*Pattern B — the senior-amplified commit:*\n\n```\na7f3c21 feat(search): add cursor-based pagination for users endpoint\n9e2b8f4 perf(search): replace LIKE '%q%' with full-text index\n12a4e5c test(search): add edge cases for empty query and unicode input\n8d1f90b refactor(search): extract query builder into reusable module\nf5a23de chore(deps): upgrade full-text-search-lib to 2.3.1\n```\n\nSmall, atomic, well-described commits. The developer guided AI to produce focused changes, committed each unit separately, and wrote messages a future debugger will thank them for.\n\n*Same AI. Same prompts, roughly. Radically different commit history.*\n\nA Git history full of Pattern A commits is a Git history that can't be bisected, can't be reverted cleanly, can't be understood by anyone who joins the team later. Every tool that relies on commit granularity — `git bisect`\n\n, `git revert`\n\n, `git blame`\n\n, `git log --follow`\n\n— degrades to the point of uselessness.\n\nBefore AI, bad commits came from rushed developers. They were relatively rare because writing bad commits took effort too — a huge \"fix stuff\" commit still required the developer to write the code. Now, bad commits are effortless. AI produces working code fast, and if the developer doesn't pause to structure the commits, everything lands as one undifferentiated blob.\n\nThis is the amplification effect in its purest form: AI doesn't cause bad commit practice, but it removes the friction that used to limit how many bad commits a team could produce per day.\n\nIf you've worked with a senior developer using Claude Code or Cursor for real production work, you'll notice they don't work the way demos suggest. Demos show a developer asking AI to build a feature, accepting the output, committing, done. Senior developers rarely work that way.\n\nWhat they actually do:\n\n*They break work into commits before writing a single line.* Before prompting AI, they think: \"This feature needs three commits — the refactor, the new endpoint, the tests. I'll work on one at a time.\" Then they prompt AI per-commit, not per-feature.\n\n*They review AI output for what it didn't do.* AI produces code that answers the prompt. It doesn't answer the things you didn't ask about. Seniors read AI output asking \"what edge case is missing? what error isn't handled? what happens at scale?\" — and iterate until the output is actually ready.\n\n*They rewrite commit messages by hand.* Even when tools offer auto-generated messages, seniors rewrite them. Because the message needs to explain *why*, not *what* — and AI can see *what* changed but not *why* it was the right change.\n\n*They separate refactors from features.* A change that both refactors existing code and adds a new feature is a bisect nightmare. Seniors do the refactor, commit it, verify nothing broke, then add the feature as a separate commit.\n\nNone of this is specific to AI. These are basic fundamentals of Git hygiene. AI just made them dramatically more important, because AI makes it easier to skip them.\n\nRun these queries on any team that's been using AI assistance for a while, and the amplification effect becomes quantifiable:\n\n*Commits per PR — the concentration test:*\n\n```\n# How many commits does each PR typically have?\ngh pr list --state merged --limit 100 --json commits \\\n  --jq '.[] | .commits | length' | sort | uniq -c | sort -rn\n```\n\nA healthy team, AI-assisted or not, has most PRs with 2-6 commits. If suddenly your team has half of PRs with 1 commit of 500+ lines, that's the junior-amplified pattern.\n\n*Commit message quality — the scoping test:*\n\n```\n# Average commit message length\ngit log --since=\"3 months ago\" --pretty=%s \\\n  | awk '{ sum += length($0); count++ } END { print \"avg length:\", sum/count, \"chars\" }'\n```\n\nTeams writing good commit messages average 50-80 characters on the subject line. Teams that rubber-stamp AI's first suggestion average 20-30. If your team dropped to the lower range after adopting AI, it's a signal.\n\n*Changed files per commit — the atomicity test:*\n\n```\n# How many files does each commit touch on average?\ngit log --since=\"3 months ago\" --name-only --pretty=format:'---' \\\n  | awk '/^---$/ { if (count > 0) print count; count = 0; next } { count++ } END { if (count > 0) print count }' \\\n  | awk '{ sum += $1; n++ } END { print \"avg files per commit:\", sum/n }'\n```\n\nAtomic commits touch 1-5 files. If your average jumped to 15+ after AI adoption, commits are no longer scoped to individual changes.\n\nThese aren't vanity metrics. Each one directly correlates with how debuggable, revertable, and understandable your codebase is.\n\nIf you want your team to use AI without destroying your Git history:\n\n*1. Commit before asking AI to do the next thing.* Treat each AI interaction as one logical unit of work. If the unit spans multiple concerns, the unit is too big — break it down first, commit as you go.\n\n*2. Write the commit message yourself.* Tools that auto-generate messages from diffs are convenient, but they miss the \"why.\" Spend 30 seconds writing the message in your own words. Future you will save hours.\n\n*3. Review the diff before committing, even if AI wrote it.* Seniors do this automatically. It's the equivalent of proofreading a translation — AI translated intent to code, you verify the translation matches what you meant. Unreviewed commits are a liability, AI-generated or not.\n\nSome teams have adopted a tag in commit messages to mark AI assistance explicitly:\n\n```\nfeat(auth): add SAML SSO provider [ai-assisted]\n\nImplemented SAML 2.0 response parsing using python-saml library.\nGenerated test cases for malformed responses and signature\nvalidation failures.\n\nAI helped with: SAML library integration, test generation\nHuman decisions: auth flow design, error handling strategy\n```\n\nThis is optional and your team may or may not want it. But it makes two things explicit: that AI was involved, and what specifically the human brought to the table. When a bug surfaces months later and someone `git blame`\n\ns the line, they can see immediately whether the code was AI-generated and what context the human applied.\n\nIt's not a defensive measure (\"don't blame me, AI wrote it\"). It's an informational one (\"here's the context you need to understand this change\").\n\nIf you've been using AI assistants seriously for a year, you've probably noticed something that doesn't make the headlines: *you're more careful about commit hygiene now than you were before*.\n\nPre-AI, if you wrote sloppy commits, you paid the cost linearly. You produced maybe 5-10 commits a day, so sloppy habits had bounded blast radius. Post-AI, you produce 30-50 commits a day. Sloppy habits destroy the codebase in a quarter.\n\nThe seniors who thrive in this new environment aren't the ones using AI the hardest. They're the ones who realized early that AI's productivity gain has to be matched by increased discipline elsewhere. Every minute saved by AI in writing code gets spent in structuring, reviewing, and documenting that code.\n\nThat's the amplifier in action. Use it well, and your output multiplies. Use it carelessly, and your technical debt multiplies just as fast.\n\n*This post is part of a series on AI and engineering fundamentals. My book* [Git in Depth](https://mdenda.gumroad.com/l/git-in-depth)*is 658 pages on the Git fundamentals that AI assumes you already know — including atomic commits, commit message anatomy, and bisect workflows.*\n\n*Related:* [Why AI made fundamentals more valuable, not less](https://dev.to/mdenda/why-ai-made-fundamentals-more-valuable-not-less-3a8f)*.*\n\n*See all my articles on Git and engineering practice:* [dev.to/mdenda](https://dev.to/mdenda)*.*", "url": "https://wpnews.pro/news/what-happens-when-an-ai-agent-commits-to-your-repo", "canonical_source": "https://dev.to/mdenda/what-happens-when-an-ai-agent-commits-to-your-repo-4cgg", "published_at": "2026-05-27 13:00:00+00:00", "updated_at": "2026-05-27 13:10:58.219552+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "artificial-intelligence", "generative-ai", "ai-products"], "entities": ["Claude Code", "Cursor", "GitHub Copilot", "Windsurf", "Git"], "alternates": {"html": "https://wpnews.pro/news/what-happens-when-an-ai-agent-commits-to-your-repo", "markdown": "https://wpnews.pro/news/what-happens-when-an-ai-agent-commits-to-your-repo.md", "text": "https://wpnews.pro/news/what-happens-when-an-ai-agent-commits-to-your-repo.txt", "jsonld": "https://wpnews.pro/news/what-happens-when-an-ai-agent-commits-to-your-repo.jsonld"}}