BuildGist

How to undo Claude Code changes

Kayvan Zahiri ·

To undo what Claude Code just did, run /rewind, or press Esc twice with the prompt empty, pick the prompt to go back to, and choose Restore code. That reverts edits made with Claude Code's file editing tools. Files changed by Bash commands, by you, or by another session are not covered, and Git is how you undo those.

The rewind menu

Claude Code's checkpointing documentation, read on October 16, 2026, says each prompt you send that starts a turn saves a checkpoint of the code first. The rewind menu lists the prompts you sent in the session. Select one, then choose:

The two code choices appear only when there are tracked file changes after that point. After you restore the conversation, the prompt you picked goes back into the input, so you can edit it and send it again.

Checkpoints are saved with the conversation, so /rewind still works after you resume a session. Where sessions are kept, and for how long, is in where Claude Code keeps session history.

What rewind does not undo

The documentation says checkpoints are for quick recovery inside a session, not a replacement for version control. Keep using Git.

Undo with Git

Start by seeing what is there. In the project folder:

git status
git diff --stat

git status also lists edits you made before the run. Each command below acts on your lines as well as the agent's, so read the diff of a file before you discard it.

Changes nobody committed

git restore path/to/file
git restore --staged path/to/file

The first puts a file back as it was at the last commit, or as staged. The second unstages it, so the first can then put it back. A file the agent created is untracked, and git restore leaves it alone. Delete it yourself once you have read it.

To set the whole attempt aside without losing it:

git stash --include-untracked

That empties the working tree back to the last commit and keeps the changes, new files included. git stash pop brings them back.

Commits the run made

git log --oneline -5
git revert <commit>

git revert adds a new commit that undoes the one you name, which is safe on a branch other people have pulled. Rewriting history with a reset is a different decision, and a riskier one once the commit is pushed.

Try again without losing the first attempt

To try a different approach and keep the first one, the documentation suggests /branch inside the session, or claude --continue --fork-session when you start. Each copies the conversation so far into a new session and leaves the original as it was. That copies the conversation, not the files. To keep the first attempt's code, stash or commit it first.

Know what you are undoing

An undo is a review in reverse. Before you throw a run away, look at what it changed, so you keep the part that was right. Read sign-in, deletion, payments, new dependencies and configuration first. The order is in what did Claude Code change?, and the checks before you keep a change are in how to review AI-generated code before you merge.

BuildGist explains each meaningful Claude Code, Cursor and Codex run in plain English and flags concerns, so you can see what a run did before you decide to keep or undo it. BuildGist does not undo anything. Rewind and Git do that. The explanation is written by AI, so check important behavior against the code and tests.

What you need

Codex needs you to approve BuildGist once, in Codex. BuildGist shows the steps. Setup is in Getting started.

To explain a run, your computer sends BuildGist what that run needs, and BuildGist passes it to Anthropic. BuildGist does not keep this material. It does not send your whole repository, files the run did not change, or files named like secrets, such as .env files and keys. It keeps the explanation and short cited excerpts of changed code, at most 12 lines each. Secret masking is best-effort. Privacy has the full list.

Every account gets 7 days of BuildGist Pro free, with no card. The 7 days start at your first explanation or Continue handoff. Nobody is charged when the trial ends. After that, BuildGist Pro is $12 per month, plus any applicable tax shown at checkout. See pricing.

Try BuildGist

Apple silicon, macOS 12 or later. United States, 18 or older.

Related

Questions: kayvanandre@gmail.com.