Review what Claude Code changed before you commit
Last updated: 8 October 2026
Before you commit what Claude Code did, check three things: which files changed, what changed in them, and that you stage only what you read. Claude's reply at the end of a turn is a summary written by the model, not that list (what did Claude Code just change?). Claude Code and git each give you the list; this page says what each view leaves out.
1. In Claude Code: /diff
Run /diff. From the interactive mode documentation: "You see the edits Claude has made so far alongside anything else you haven't committed." In a test on 8 October 2026 with Claude Code 2.1.293, after a turn that edited one file and ran a build, the dialog listed all three changed files:
What to know about it, from the same page: the views of a single turn "come from Claude's file edits rather than from git, so a change Claude makes through a shell command appears only under Current, the working-tree view". The side panel needs a git repository, and "the list skips test files and generated files" until you expand them. After that, "/code-review checks the current diff for correctness bugs" (commands).
2. The files a shell command changed
Claude Code can also show, under a Bash call, the files that changed while it ran. The bashEditDiffEnabled setting "records which files changed in a Git repository while a Bash command runs", and by default does so "in auto mode and bypassPermissions mode when it directs Claude to edit files through Bash". In the test above, npm run build rewrote two files Claude never opened, and the Bash call showed them:
Its limits, from the setting's entry: "A listed file isn't always one the command changed. A change that another program or another Bash call made while the command ran can appear there too." It records only in a Git repository, and outside the two modes above only if you turn it on in your user settings.
3. In git: status, then diff
git status shows, among others, "paths in the working tree that are not tracked by Git (and are not ignored by gitignore[5])" (git status). A file your .gitignore excludes, such as a new .env, is not in that list; git status --ignored adds it: "Show ignored files as well." New files Claude created are among those untracked paths. Then read the changes: plain git diff is "to view the changes you made relative to the index (staging area for the next commit)", and git diff --cached, which shows "the changes you staged for the next commit relative to the named <commit>" (git diff).
4. Stage what you read
GitHub's advice on avoiding accidental commits fits work an agent did:
- "Avoid the catch-all commands git add . and git commit -a on the command line—use git add filename and git rm filename to individually stage files, instead."
- "Use git add --interactive to individually review and stage changes within each file."
- "Use git diff --cached to review the changes that you have staged for commit. This is the exact diff that git commit will produce as long as you don't use the -a flag."
If the diff holds a key, stop and rotate it first: Claude Code wrote an API key into my code.
Where turnslip helps
turnslip keeps a record per turn: the slip under each reply, as in the test above, counts the files the turn changed, shell commands included, also in a folder that is not a git repository. When Claude's receipt of the files it changed leaves one out, the slip says not mentioned: and names it. In this test Claude did mention the two build files, so there was none. With Pro, /turnslip:report gives a report of this session. It works only if it was installed before the turn, and like git it never reads what your .gitignore excludes.
Related: What did Claude Code just change? · All guides · Install turnslip, free