Journal
Tutorials

Claude Code Checkpoints & Rewind: Undo an Edit Without Losing Your Session

C

Clearly Team

Engineering

5 min read
Jul 10, 2026

Claude Code Checkpoints & Rewind: Undo an Edit Without Losing Your Session

Claude Code makes one bad edit, and your instinct is to nuke the whole session and start over. Usually you don't have to. Rewind rolls your files back to before that edit while keeping the conversation — so you lose the bad diff, not the good context. Here's how it works, and when to reach for it instead of a full restart.

Checkpoints, automatically

Before Claude Code edits a file, it quietly snapshots it — a checkpoint. You don't set these up; they happen on every edit. That snapshot stack is what lets you step backward through changes.

Rewinding

Press Esc twice to rewind. Claude Code walks back through the checkpoints, restoring your files to an earlier state. Crucially, rewind restores files, not the conversation — the reasoning up to that point stays in context. So you undo the change without undoing the understanding.

What it does not restore: anything outside your local files — a database write, an API call, a deploy. Those already happened. Rewind is for the code on disk.

Rewind vs. restart — which one

This is the key call:

  • Rewind when the edit was wrong but the session is fine — one bad change, good reasoning up to it. Roll the files back and keep going. Cheapest fix there is.
  • Restart (/clear or a fresh session) when the context itself has gone bad — loops, drift, an anchored wrong assumption. Rewinding files won't help; the problem is the conversation. (When to kill the session instead →)

The mistake is using a full restart for a problem a rewind would've fixed in two keystrokes — and vice versa. Wrong edit → rewind. Poisoned context → restart.

Across sessions

Rewind and restart are per-session moves, and the judgment call — bad edit or bad context? — gets harder when you're running several agents at once. Mwah helps you triage: every live session on your desktop as a robot flagged ALIVE or STUCK, so you can tell the one that made a bad edit (rewind it) from the one whose context is gone (and put it down).


Related: Shoot your Claude Code in the head · How to restart Claude Code

#claude code#checkpoints#rewind#agentic coding#developer workflow