# Review what Claude Code changed before you commit: /diff, /rewind, /code-review and git

*Review Claude Code's changes before you commit: /diff, git add -p, /code-review, what /rewind cannot undo, Codex's review pane, and an annotated diff.*

Dmitriy Solodukha, checked 2026-11-27 · https://caprock.dev/guides/review-claude-code-changes/

Read the diff before you commit. In the session, `/diff` shows the working
tree's changes, Claude's edits included; `git add -p` then stages them hunk
by hunk, so nothing goes in unread. `/code-review` (alias `/review`) adds a
second pass that looks for bugs. `/rewind` undoes Claude's own file edits,
but not what a Bash command changed: git is the safety net, not checkpoints.

**In short**
- **See it:** `/diff` in the session, `git diff --stat` outside it.
- **Stage what you read:** `git add -p`, then `git diff --staged`.
- **Undo:** `/rewind` for Claude's edits; git for everything else.
- **What Caprock adds:** the diff beside the agent, with notes on lines sent
  back to it in one click.

## What Claude Code gives you

*Claude Code's review tools, from Anthropic's docs, read 27 November 2026.*

| Command | What it does |
| --- | --- |
| `/diff` | the working tree's changes, Claude's edits included |
| `/rewind` (Esc Esc) | restores code, conversation or both to a checkpoint |
| `/code-review` (`/review`) | a review of the branch's commits and uncommitted changes; `--fix` applies findings |
| `/security-review` | the diff against `origin`'s default branch, for security issues |

`/code-review` takes a pull request number, a branch, a path or a range, and
an effort level. It runs as a background subagent and counts toward your
usual limits.

In the VS Code extension, *Manual* mode shows each edit as a side-by-side
diff to accept, reject or change first; in *Auto* mode most files are edited
without asking.

## What /rewind cannot undo

Claude Code saves a checkpoint of the files its edit tools change before each
prompt, and keeps the 100 most recent. A rewind does not restore:

- **Files changed only by Bash** — a `sed`, a code generator, `npm install`.
- **Most subagent edits,** including a background `/code-review --fix`.
- **Your own edits,** and edits from other sessions running at the same time.

Anthropic's docs say it plainly: checkpoints are not a replacement for
version control. Commit before a large task, or run it in a
[worktree](https://caprock.dev/guides/claude-code-worktrees/).

## Review with git

1. git diff --stat: `undefined`
2. git add -p: `undefined`
3. git diff --staged: `undefined`

`--stat` lists the files and how much each changed — a file you did not
expect is the first thing to look at. `git add -p` walks every hunk and asks
y or n, so you read each change before it is staged, and the last command
shows exactly what the commit will hold.

## Make Claude check its work before it stops

A **Stop hook** runs when Claude is about to finish. If it returns
`{"decision": "block", "reason": "…"}` — say, because the tests failed —
Claude keeps working instead of stopping. A **PreToolUse** hook can block a
tool call before it runs, such as a write to a file you protect. Both are in
[Claude Code hooks](https://caprock.dev/guides/claude-code-hooks/).

## Codex: /diff, /review and the app's pane

- **CLI:** `/diff` shows the Git diff, untracked files included; `/review`
  asks Codex to review the working tree; `codex review --uncommitted` (or
  `--base`, `--commit`) does it from the shell.
- **The Codex app** has a review pane: unstaged, staged, a commit, the
  branch or the last turn; stage, unstage or revert a file or a hunk; leave
  inline comments.

## Review on GitHub, after the push

- **Claude Code Review** — several agents review each pull request and post
  inline comments, on open, on every push or on request (`@claude review`).
  Team and Enterprise plans only; billed on tokens through usage credits,
  with no flat price per review.
- **Codex** — comment `@codex review`, or turn on automatic review; it flags
  P0 and P1 issues and reads rules from `AGENTS.md`.

## Other review panes

- **Warp** — a Code Review panel of uncommitted changes or the branch
  against main; inline comments go to the running agent, third-party CLI
  agents included.
- **Cursor** — *Find Issues* checks the agent's edits; Bugbot reviews pull
  requests.

## What Caprock adds: the diff beside the agent

Caprock is a free, open-source desktop app for macOS, Windows and Linux that
runs Claude Code, Codex and other agents in real terminal tabs. Its Changes
view (⇧⌘G, Ctrl+Shift+G) sits beside the session:

- **Staged, unstaged, new and conflicted files,** each diff unified or side
  by side; stage or unstage single hunks.
- **Notes on the diff, sent to the agent.** Click a line number (⇧-click for
  a range) to leave a note; *Send to agent* types every note, with its file,
  lines and code, into that session.
- **Commit with the agent's words.** The message can start from what the
  agent said last; Commit, Commit & Push, Push (never forced). Your git hooks
  run.
- **Fix with agent.** A commit a hook refused, files in conflict or a pull
  request's failing check goes to the agent in that worktree with its
  output.
- **After the push,** the pull request's checks by name, what blocks it and
  how long CI is taking against its usual.

It works on any git repository, whichever agent made the change, and the
review features are part of the free app.

## Which to use

- **`/diff` and `git add -p`** — every commit; nothing to install.
- **`/code-review` or Codex's `/review`** — a second opinion before a pull
  request.
- **Claude Code Review or `@codex review`** — a team that reviews on GitHub.
- **Caprock** — several agents at once, and you want to read, annotate and
  commit each one's work without leaving its session.

## Sources

- [Claude Code docs — Checkpointing: /rewind, what it does not track, read 27 November 2026](https://code.claude.com/docs/en/checkpointing)
- [Claude Code docs — Commands: /diff, /security-review, /code-review, read 27 November 2026](https://code.claude.com/docs/en/commands)
- [Claude Code docs — Local code review: /code-review (alias /review), --fix, read 27 November 2026](https://code.claude.com/docs/en/code-review-local)
- [Claude Code docs — Code Review for GitHub pull requests, read 27 November 2026](https://code.claude.com/docs/en/code-review)
- [Claude Code docs — Code Review costs, read 27 November 2026](https://code.claude.com/docs/en/code-review-costs)
- [Claude Code docs — VS Code extension: the diff view, read 27 November 2026](https://code.claude.com/docs/en/vs-code)
- [Claude Code docs — Hooks: Stop and PreToolUse decisions, read 27 November 2026](https://code.claude.com/docs/en/hooks)
- [OpenAI — Codex commands: /diff, /review, read 27 November 2026](https://learn.chatgpt.com/docs/developer-commands?surface=cli)
- [OpenAI — Codex app: code review pane, read 27 November 2026](https://learn.chatgpt.com/docs/code-review?surface=app)
- [OpenAI — Codex on GitHub: @codex review, read 27 November 2026](https://learn.chatgpt.com/docs/third-party/github)
- [Git — git-add documentation: --patch, read 27 November 2026](https://git-scm.com/docs/git-add)
- [Warp docs — Code Review, read 27 November 2026](https://docs.warp.dev/code/code-review)
- [Cursor docs — Agent review, read 27 November 2026](https://cursor.com/docs/agent/review)
- [Caprock CHANGELOG — 0.78.0 Review and commit without a terminal, 0.102.0 review notes and Fix with agent](https://github.com/dspv/caprock/blob/master/CHANGELOG.md)
- [Caprock docs — the Changes view (docs/app.md)](https://github.com/dspv/caprock/blob/master/docs/app.md)
