Undo and rewind

  • Lesson 6 of 8
  • 3:51

Buy the course to watch this lesson

Buy the course to unlock all 8 videos

In this episode

Claude Code really edits the files on your computer. When it breaks something, or you change your mind, here's how to go back:

  • Press Esc twice to open the rewind menu: with the input box empty, press Esc twice and Rewind appears. It lists every message you sent, and under each one how many files it changed
  • Pick and press Enter: use ↑ ↓ to choose the message to undo, press Enter, and pick the first option, Restore code and conversation. Files and conversation go back to just before that message, and the message comes back into the input box so you can rewrite it
  • The other options: restore only the conversation, only the code, or never mind, and when to use each
  • Esc twice with text in the box clears it: with text, two presses clear the box; with the box empty, two presses rewind
  • /rewind: opens the same menu
  • A real example: Mom's 12 home-style recipes
    • One message turns them into a large-print web page for her phone, and it notices the sweet-and-sour ribs recipe never says when to add the sugar
    • On a whim, it's asked to rewrite the page and all 12 recipes in English. When done, it points out that if Mom doesn't read English, a Chinese copy should be kept
    • Two presses of Esc and all 13 files are back in Chinese; asked differently, it makes a separate English page and leaves every Chinese file alone
  • What rewind can't undo: files it deleted or moved by running commands; and files go back whole, so changes you made yourself afterwards are lost too. Copy important files before letting it work on them

Before you start

  • Claude Code installed (episode 2)
  • You know how to start it and talk to it (episode 3)

Next: Managing sessions.