Setup and context
When working with Antigravity to generate or modify code, understanding exactly what the AI has changed is crucial. Blindly accepting AI suggestions can introduce subtle bugs or break existing logic you hadn't intended to touch.
That's where Diff View comes in. Antigravity's Diff View highlights every change the AI proposes — additions in green, deletions in red — so you can review each modification before committing to it. In this guide, we'll walk through everything from the basics of Diff View to advanced techniques for managing complex, multi-file changes.
What Is Diff View?
Diff View shows you a side-by-side or inline comparison of your original code versus what the AI is proposing. Think of it as a visual git diff, but built directly into your editor and designed for real-time collaboration with AI.
The key visual indicators are:
| Color | Meaning |
|---|---|
| Green (+) | Lines the AI is adding |
| Red (−) | Lines the AI is removing |
| Gray | Unchanged lines for context |
How to Open Diff View
From the Chat Panel
Whenever the AI proposes a code change in the chat panel, you'll see a "View Diff" button above the suggested code block. Click it to open the Diff View instantly.
[Chat Panel]
AI: I've updated src/utils/formatter.ts for you.
[View Diff] [Apply] [Reject]
From a File Tab
If you've already applied a change and want to review what the AI did, open the modified file and click the Diff icon in the top-right corner of the tab bar. This brings up the diff for the most recent AI-applied change — handy for double-checking after the fact.
Accepting Changes Selectively
One of Antigravity's most powerful Diff View features is the ability to accept or reject changes at the chunk or line level, rather than all-or-nothing.
Chunk-Level Controls
Each contiguous block of changes (a "chunk") displays three action buttons:
- ✓ Accept Chunk — Apply this chunk's changes
- ✗ Reject Chunk — Discard this chunk's changes
- ✎ Edit Chunk — Manually adjust the proposed changes before applying
For example, if the AI simultaneously renames a function and optimizes its internal logic, you can reject the rename while accepting the logic improvement — giving you precise control over your codebase.
Line-Level Controls
For even finer control, hover over any individual line in the diff to reveal "+" and "−" icons that let you accept or reject that single line independently.
Switching Between Inline and Side-by-Side Modes
Diff View supports two display modes to suit different workflows.
Inline Mode
Both old and new code appear in a single column, interleaved with color-coded additions and deletions. This is great for keeping a sense of the file's overall flow while reviewing changes.
Side-by-Side Mode
The original code appears on the left and the proposed code on the right. This layout makes it much easier to compare before-and-after states, especially for large or complex changes.
Toggle between modes using the "Inline / Split" control in the top-right corner of Diff View.
Managing Diffs Across Multiple Files
A single AI action in Antigravity can span multiple files. When this happens, the left panel of Diff View shows a list of all modified files along with a summary of additions and deletions for each.
Modified Files:
📄 src/components/Header.tsx [+12 / -3]
📄 src/styles/globals.css [+5 / -0]
📄 src/utils/navigation.ts [+8 / -15]
Click any file to jump to its diff. From the file list, you can also use "Accept All" to approve every change across all files, or "Reject All" to discard everything at once.
Practical Workflows Using Diff View
1. Reviewing Large-Scale Refactors
When you ask the AI to perform a sweeping refactor, Diff View becomes your safety net. Always step through the file list and review each diff before accepting.
# Example Prompt
"Migrate all API calls in src/services/ from Axios to the native fetch API."
A change like this touches many files. Building a habit of reviewing each file in Diff View helps you catch unintended modifications before they make it into your codebase.
2. Adding Review Notes to the Diff
You can attach inline comments to specific lines within Diff View. These are useful for noting why you accepted a particular change, flagging areas for follow-up review, or leaving context for teammates.
+ const result = await fetchUserData(userId);
// ↑ Review caching strategy here before merging
3. Browsing Change History
Antigravity keeps a history of diffs for each AI session. Open the "History" tab in Diff View to browse past changes and, if needed, revert to a previous state — a lifesaver when an earlier AI suggestion turns out to have been the better approach.
Troubleshooting Common Issues
Diff View Won't Open
- Make sure Antigravity is up to date — older versions may lack full Diff View support.
- Files listed in
.gitignoreor.antigravityignoremay be excluded from the diff display.
The Diff Is Too Large to Review Comfortably
If the AI changes too many files or lines at once, reviewing becomes overwhelming. Break your prompts into smaller, focused requests and apply changes incrementally.
# Recommended approach
Step 1: "Refactor only the Header component."
Step 2: "Now refactor the Footer component."
Step 3: "Clean up shared styles."
You Need to Undo an Applied Change
If you've already applied a change and want to roll it back, find the relevant message in the chat history and click "Revert". Alternatively, Ctrl+Z (or Cmd+Z on Mac) works for recent changes, though the Revert button is more reliable for multi-file operations.
Wrapping Up
Antigravity's Diff View is an essential tool for working safely and efficiently with AI-generated code. Here's a quick recap of what it offers:
- Chunk- and line-level acceptance for precise control over what gets applied
- Inline and side-by-side modes to match your review style
- Multi-file change management to keep complex refactors organized
- History browsing and revert so you can experiment with AI suggestions without fear
Rather than blindly applying AI-generated code, developing the habit of reviewing diffs helps you maintain code quality while still benefiting from the speed of AI assistance. Give Diff View a central place in your Antigravity workflow — your future self (and your teammates) will thank you.