ANTIGRAVITY LABJP
Articles/Editor View
Editor View/2026-06-26Advanced

Splitting a Giant Antigravity Diff Into Meaningful Commits

Are you committing the agent's 400-line diffs as a single blob? Here is a practical workflow, with scripts, for re-splitting an unreviewable bulk commit into one concern per commit.

Antigravity272git9code review3commit designworkflow46indie dev15

Premium Article

One morning I asked Antigravity to fix a login issue, nothing more. What came back was a diff across 9 files and roughly 420 lines. As I started reading, I noticed that besides the authentication middleware fix, it had also tidied up type definitions, removed unused imports, and adjusted a few error message strings, all blended into one block.

Every change was reasonable. But if I sealed it with a single git commit -am "fix login", then later wanting to undo just the wording change would mean reverting the auth fix along with it. As a reviewer, reading 420 lines in one breath is more than my attention can hold. That diff ended up hanging in limbo for half a day until I split it apart.

Agents do not separate concerns as they write. Whatever can be solved at once, they write at once. That is exactly why it pays to keep, in your own hands, a step that re-splits the result into units of meaning, even when you work as an indie developer on a solo project. Today I want to share how I do that, along with the script I actually use.

Why a Bulk Commit Becomes a Burden Later

The problem with a giant commit is not just that it reads poorly. The deeper costs are these three.

First, the granularity of rollback becomes coarse. git revert works only at the commit level. When a feature change and a refactor live in the same commit, there is effectively no way to undo just one of them.

Second, review turns into a formality. Human attention is finite. Shown 400 lines at once, you read the first few dozen carefully and then drift into "this is probably fine" for the rest. I see this even in my own code: when I try to review everything at once, I miss more.

Third, git bisect loses its edge. When you binary-search for the commit that introduced a bug, a commit holding several concerns lets you find the culprit commit but leaves you unsure which change inside it is to blame.

AspectBulk commitPer-concern commit
RollbackAll or nothingrevert one concern at a time
ReviewLatter half gets skimmedEach one is small and focused
Root causebisect finds the commit, not the changeCulprit commit equals culprit change
History meaningVague, like "fix login"Each commit states its intent

The ideal is one concern per commit. Yet asking an agent to write that way from the start is unrealistic, because concerns naturally tangle as a fix unfolds. So I make my peace with it: let it write freely, and split when committing.

What You Can Do Bare-Handed: git add -p

The foundation of splitting is the interactive staging that Git ships with. git add -p shows the diff one hunk (a chunk of change) at a time and lets you accept or reject each.

# Stage interactively, reviewing the working tree hunk by hunk
git add -p

At the accept/reject prompt, the keys I use most are y (include this hunk), n (skip it), s (split it smaller), and e (edit by hand). You pick up only the auth changes with y, set the wording changes aside with n, and commit the auth part first.

# After staging only the auth-related hunks, commit
git commit -m "fix(auth): correct SameSite attribute on the session cookie"
# Re-stage the rest as the next concern
git add -p
git commit -m "refactor: tidy up auth middleware type definitions"

This bare-handed method is reliable, but processing 420 lines across 9 files one hunk at a time is hard work. Even with s, when related hunks are scattered across separate files you have to remember in your head which belong to the same concern. Letting Antigravity assist here is today's real subject.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Why one giant commit makes review and rollback painful, and how to design around it
A prompt with an output contract that classifies hunks by concern, plus the script that commits them one at a time
A per-commit build gate, and how to handle hunks that genuinely overlap
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Editor View2026-04-13
Gemma 4 × Antigravity: Build a Local AI Code Review Setup That Never Sends Your Code to the Cloud
Run Gemma 4 locally and integrate it with Antigravity's editor for AI-powered code reviews that keep your proprietary code entirely on your machine.
Editor View2026-03-27
How to Resolve Git Merge Conflicts with AI in Antigravity
Learn how to leverage Antigravity's AI agent to efficiently resolve Git merge conflicts. Covers Diff View integration, complex conflict patterns, and team workflow best practices.
Tips2026-04-27
Half-Automating CHANGELOG.md From git log With Antigravity — A Solo Developer's Decision Log
You opened your code from six months ago and forgot why you made that change. A common solo-dev problem. Here's a half-automated workflow that uses Antigravity to draft CHANGELOG.md entries straight from your git log, with a working shell script.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →