Claude Code /diff: See Exactly What Changed, Turn by Turn
What Is /diff
When Claude Code helps you write code, after a few rounds of conversation it may have modified several files. You know roughly what was done, but you’re not sure exactly which lines changed in each file or what logic was added.
/diff is for viewing those changes. It opens an interactive panel showing code differences from two perspectives:
- Current — all uncommitted changes in your working directory (
git diff HEAD) - Per-Turn — changes broken down by conversation turn
No need to switch to another terminal to run git diff, and no need to scroll through chat history guessing which files Claude modified.
How to Use It
/diff
No arguments needed. It opens an interactive dialog immediately.
What the Interface Looks Like
Top: Source Selector
Current . T1 . T2 . T3
- Current — git diff of working directory vs HEAD, including unstaged and untracked files
- T1, T2, T3… — changes from each conversation turn (most recent first)
Use left/right arrow keys to switch between sources.
Middle: File List
After selecting a source, all modified files in that scope are listed:
> src/utils/auth.ts +15 -3
src/components/Login.tsx +42 -0
src/tests/auth.test.ts +28 -5
package.json +1 -0
Each file shows its path and line additions/removals. Untracked new files are labeled “untracked”, binary files labeled “Binary file”.
Use up/down arrow keys to select a file, press Enter to view details.
Bottom: File Details
Press Enter to open the detailed diff view for a single file:
- Line-by-line differences with line numbers
- Word-level highlighting — not just marking entire lines as added/removed, but pinpointing exactly which words changed
- Green for additions, red for removals
- Changes exceeding 400 lines are truncated
Press left arrow or Esc to return to the file list.
Keyboard Shortcuts
| Key | Action |
|---|---|
| ← / → | Switch source (Current / T1 / T2…) |
| ↑ / ↓ | Select file |
| Enter | View detailed diff for selected file |
| ← | Return from detail to list view |
| Esc | Close dialog |
Two Data Sources Explained
Current: Git Perspective
The “Current” tab shows the result of git diff HEAD — all changes in your working directory relative to the last commit.
Its data comes from actual git commands:
git diff HEAD --numstat— get addition/removal stats per filegit diff HEAD— get full diff contentgit ls-files --others --exclude-standard— list untracked new files
Built-in safeguards:
- Over 500 files: shows stats only, no details
- Single file over 1MB: skipped
- Single file over 400 changed lines: truncated
- Merge/rebase/cherry-pick in progress: diff not shown
- Git timeout: 5-second protection
This perspective is ideal for checking all changes before committing.
Per-Turn: Conversation Turn Perspective
The “T1”, “T2” tabs show changes Claude Code made in each conversation turn.
The data source isn’t git — it’s the conversation messages themselves. Claude Code extracts FileEdit and FileWrite results from tool call records, reconstructing each turn’s diff.
Benefits of this perspective:
- Traceable — you can see “what Claude changed in round one, what it changed in round two”
- Unaffected by git state — even if you manually modified files or ran git add in between, Per-Turn view still accurately reflects Claude’s changes
- Most recent first — quickly check what just happened in the latest turn
Each turn’s tab shows a preview of your input message (first 30 characters) to help you recall what that turn was about.
Typical Use Cases
Scenario 1: Pre-Commit Review
You: Refactor the auth module, split into separate service and controller
(Claude Code executes multiple rounds of changes)
You: /diff
Switch to the “Current” tab, verify all file changes look reasonable, confirm there are no unexpected modifications, then commit with confidence.
Scenario 2: Turn-by-Turn Audit
A complex task where Claude Code went through 5 conversation turns. You want to know what each step did:
/diff
Switch from T1 through T5, reviewing each turn’s changes to understand Claude’s approach and execution process.
Scenario 3: Combine with /review
Check current changes with /diff first, then ask Claude to review:
/diff
(after reviewing changes)
Review these changes for me, focusing on security
Scenario 4: Combine with /rewind
Found a problematic change in one turn using /diff? Use /rewind to roll back to before that turn. The Per-Turn view in /diff adapts automatically — reverted turns disappear.
Relationship with Other Commands
| Command | Relationship |
|---|---|
/review | /diff views changes, /review reviews PRs. One for local, one for remote |
/rewind | /diff views per-turn changes, /rewind rolls back to a turn. One views, one reverts |
/context | /diff views code changes, /context views context usage. Different dimensions of “status check” |
/compact | After context compaction, Per-Turn records are preserved — /diff extracts from messages, unaffected by compaction |
Practical Tips
Tip 1: Make Pre-Commit Diff Review a Habit
After every task Claude Code completes, run /diff before committing. This isn’t about distrusting AI — it’s good engineering practice. You should understand every line of code that gets merged.
Tip 2: Use Per-Turn to Understand Complex Tasks
When Claude Code executes a multi-step complex task, Per-Turn view lets you “replay” the entire process. Combined with conversation content, it’s clear what each step did and why.
Tip 3: Watch for Untracked Files
The Current view lists untracked new files. If Claude Code created files you didn’t expect (like temporary files or config files), you can catch them here.
Tip 4: Use Stats View for Large Projects
If /diff shows “Too many files to display details” (over 500 files), the change scope is large. Review the stats first to decide whether to commit in batches.
Final Thoughts
/diff is a simple but essential tool.
It doesn’t modify anything, requires no configuration — it just lets you see exactly what Claude Code changed. In the workflow of “letting AI write code,” this step may seem redundant but is actually critical — understanding the changes is what it means to truly own your code.
Make /diff a habit, and you’ll feel much more in control of AI-generated code.
More Articles
- Why AI-First Startups Only Need One Programming Language
- cc-ping: Ping All Your Claude Code Configs in One Command
- Shocking! This Tool Lets Programmers Finish 95 Minutes of Work in 4 Minutes! 24x Efficiency Boost
- CCBot - 24x Development Efficiency Boost
- Claude Code /add-dir: The Monorepo Command You Miss
- Claude Code Token-Saving Tip: The Power of the Exclamation Mark
- I Built a Bot That Runs Claude Code From Chat
- Claude Code /btw Command Explained: Quick Side Questions Without Breaking Flow
- Claude Code /compact: Free Up Context, Keep Progress
- Claude Code /config: Every Setting Explained
- Claude Code /context: What's Eating Your Context Window?
- Claude Code /fast: Same Opus, 2x Speed — Worth It?
- Best Practice for External Knowledge in Claude Code: GitHub MCP + Context7
- Claude Code /hooks: Make AI Follow Your Rules
- Claude Code /init: Generate CLAUDE.md in 10 Seconds
- Claude Code MCP: Give Your AI Access to Any Tool
- Claude Code /memory Explained: Make AI Truly Remember Your Project
- Claude Code /model: Opus vs Sonnet vs Haiku Guide
- Claude Code /permissions: Fine-Grained Control Over What AI Can Do
- Claude Code /plan Explained: Think Before You Code
- Claude Code + Playwright MCP: AI Can Finally "See" the Page
- Claude Code /resume Command Explained: Don't Let Your Conversations Go to Waste
- Claude Code /review: Let AI Do Your Code Review
- Claude Code Skills Explained: Build Your Custom Command Library
- Claude Code /stats: See How Much AI Does For You
- Claude Code /status Command Explained: Your Session Dashboard
- Claude Code /tasks Command Explained: Master Your Background Tasks
- Claude Code /usage Command Explained: Know Your Remaining Quota
- Claude Code /vim: Vim Keybindings in Your AI Coding Assistant
- Claude Code in 2026: The Only Setup Guide You Need
- The Complete Guide to Claude: From Chat to Code to Automation