~/guides/REWIND.md

Guides / Claude Code

Claude Code broke your project? Press Esc twice: checkpoints, /rewind and one deny rule

Claude Code saves a checkpoint for every prompt. Press Esc twice to restore the code or the chat, and add one deny rule so it can never git push on its own.

When Claude Code broke my project, my first reflex used to be "fix it again", and it usually got worse. But Claude Code has checkpoints built in: every prompt you send saves a copy first. This is the full version of my REWIND reel; every step was checked against the Claude Code docs on 30 Oct 2026.

01The result: press Esc twice, back to before it broke

Reel frame: a rebuilt tower of code blocks, two giant Esc keys, Claw'd and a green restored stamp
Illustration: the tower falls and two Esc presses rebuild it. In real life you pick a restore point.

When Claude Code breaks something, you don't have to ask it to rewrite or undo it by hand. Before each prompt you send, it saves a checkpoint of your files. Press Esc twice, pick the prompt from before things went wrong, and restore the code, the conversation, or both.

What you get from this guide:

  1. When checkpoints are saved and what they cover.
  2. What each option in the Esc Esc (or /rewind) menu does.
  3. The two things rewind can't bring back, and what to do instead.
  4. A copy-paste deny rule so Claude can never run git push on its own.

02① Know this first: every prompt is a save point

Reel frame: the Claude Code checkpointing docs with the every-prompt-creates-a-checkpoint line boxed
The official docs: every prompt that starts a turn creates a new checkpoint (screenshot 30 Oct 2026).

Checkpoints are automatic; there is nothing to switch on. The docs spell it out:

  1. Every prompt you send that starts a turn creates a new checkpoint.
  2. It tracks the files Claude changes with its file-editing tools.
  3. File snapshots are kept for the 100 most recent checkpoints in a session.
  4. Checkpoints are saved with the conversation, so /rewind still works after you /resume it.
  5. Snapshots are cleaned up after about 30 days by default; raise cleanupPeriodDays to keep them longer.

03② Press Esc twice and pick the prompt

Reel frame: the docs line on opening the rewind menu, with /rewind and Esc twice boxed
Open the rewind menu: press Esc twice with an empty prompt, or type /rewind.
  1. Make sure the prompt input is empty.
  2. Press Esc twice, or type /rewind, to open the rewind menu.
  3. The menu lists every prompt you sent this session; pick the one from before things broke.
  4. Choose an action (explained below).
Reel frame: the docs action list with the three restore options boxed one by one
Three ways to restore: code and conversation, conversation only, code only.
  1. Restore code and conversation: both go back to that prompt.
  2. Restore conversation: the chat goes back, the code stays as it is now.
  3. Restore code: the files are reverted, the chat stays.
  4. Summarize from here / up to here: leaves files alone and compresses part of the chat to free context space.
  5. Never mind: back to the list, nothing changes.

04③ Know the two things it can't bring back

Reel frame: the Limitations section with the Bash-commands line boxed and a red can't-undo stamp
From the docs' limitations: a file that only Bash commands changed isn't tracked.
  1. Files changed only by commands: the docs say a file that only Bash commands changed isn't tracked and stays as it is; revert it with version control such as Git.
  2. Anything already pushed to GitHub: /rewind restores tracked files on your machine, while a push changes the remote, so it can't pull that back (my reading of the docs, which say checkpoints are not a replacement for version control).
  3. Two more to know: subagent edits are usually not restored, and changes you make outside Claude Code aren't tracked either.

05④ Add one deny rule: Claude can't git push

Reel frame: the docs' settings.json example with "deny" and "Bash(git push *)" boxed
The docs' own example: put Bash(git push *) under deny and Claude won't push on its own.

Since a push can't be rewound, don't let Claude push at all. Put this in your project's .claude/settings.json (or ~/.claude/settings.json for every project) and Claude Code refuses any command that starts with git push. You push yourself.

.claude/settings.json
{
  "permissions": {
    "deny": [
      "Bash(git push *)"
    ]
  }
}
Or ask Claude to add it (replace the [])
In [this project], add a permissions.deny rule "Bash(git push *)" to .claude/settings.json. Don't touch any other setting, and show me the diff.

06Good to know

  1. The "three seconds" in the reel means it's fast, not a measured time.
  2. A deny rule is not a vault: a push written another way (for example git -C . push) isn't matched. For strict control, see hooks and sandboxing in the docs.
  3. Checkpoint snapshots are cleaned up after about 30 days by default; very old checkpoints can fail with No files were restored.
  4. Checkpoints don't replace Git: commit anything that matters.
  5. Everything here was checked against the docs on 30 Oct 2026. Claude Code moves fast and menu names can change.

Sources

Related guides