Skip to content
Agentic Levels

Everything starts here.

GuestLocal progress only
PreferencesSign in
01Start with one taskBest first move for beginners.02Check your LevelMeasure where you are.03Score an AI resultFind the habit to practice first.04Return to YouEverything you're learning, in one place.
Start here

Begin

HomeThe main entry point.New to AIStart with one useful task.
Know where you are

Measure

Check your LevelUse this after you have tried AI.Fluency ScoreScore an AI result you can review.
Build the habit

Learn

LevelsLessonsTracks
Find the reference

Library

PromptsReferenceResourcesCompare Tools
Turn it into work

Apply

Your Next MoveChoose what AI should change next.Tool SetupGet the tools ready.
Come back later

Return

YouEverything you're learning, in one place.My PathContinue from your level.Updates
Site

Site

PricingAboutFAQ & FeedbackPreferences

© 2026 Fuentes Studio

Privacy·Terms
yourCouncil
Ready to help
✦

What do you want to understand?

Ask anything about what you're learning.

Tracks›Claude Code Fundamentals
L3Lesson 4Free

Undo without panic

Esc-Esc, rewind, and what git still owns

Three edits into a session, Claude Code starts changing a file you never meant for it to touch. Your first instinct is to type three more corrections trying to talk it back into place. There was a faster way the whole time: press Escape twice, and go back to before it wandered.

16 min · You'll know exactly what a session's undo can and can't save you from

You'll learn the real undo built into every Claude Code session, exactly what it can and can't take back, and why git still matters even after you've learned to rewind.

0ACTS
  1. Watch the exampleWatchSee it done first
  2. Try it yourselfTry itFill in one blank
  3. Do it on your ownSoloSolo, then check

Before you start

Complete Run a first safe session first; this lesson is the safety net for when that first safe session drifts anyway.

Remember from Run a first safe session?

Last lesson, you learned to isolate risky work in a separate worktree before it starts. Without scrolling up, what's the relationship between that habit and this lesson's rewind?

Show one good answer

A worktree is prevention, set up before risky work starts, so your main project stays untouched no matter what happens. Rewind is the cure, used after something already went sideways, to get the current session back to a known-good point. You want both: isolate what you can ahead of time, and know how to undo what still goes wrong anyway.

The idea

A session going sideways is not an emergency. It is the single easiest thing in Claude Code to take back.

A session card drifts sideways with no way back marked on the path.
A session card drifts sideways with no way back marked on the path.
Session rewind (Esc-Esc)Git
UndoesClaude Code's own file edits, and the conversationAny committed change, to any file, from any source
LastsAbout 30 daysPermanently, across sessions and restarts
Cannot touchShell-command changes, or edits from other programsAnything you never committed
Use it for"That last stretch went wrong, take me back""I want to return to this exact state next month"

Use both. Rewind is the cure for a session gone sideways; git is the memory that outlives the session.

The real mechanic: press Escape twice, with an empty prompt box, and Claude Code opens a rewind menu, a short list of earlier points in this session you can jump back to. Pressing Escape twice with something still typed instead just clears your draft, so the empty-box part matters. From that menu you can restore the conversation and the code together, the conversation alone, or the code alone, back to that point.

Same two key presses. What they do depends on one thing.
Prompt box emptyText still typed
Escape twice doesOpens the rewind menuJust clears your draft

The box has to be empty first. Otherwise Escape twice only clears what you typed.

The Rewind MenuThe whole rewind menu in three steps.
  1. 1
    Press Escape twiceWith the prompt box empty. That opens the rewind menu.
  2. 2
    Pick a pointThe menu lists every prompt from this session. Pick the one right before things went wrong.
  3. 3
    Choose what to restoreCode and conversation together, conversation alone, or code alone.

What it actually undoes, said plainly: rewind tracks edits Claude Code made through its own file-editing tool. It does not track changes from shell commands it ran, like rm or mv, and it does not track edits any other program made to your files. If a step in your session ran a command that touched files directly, rewind may not be able to put those back.

This is not a small footnote, it is the one thing worth remembering before you trust it.

Session undo and git are two different safety nets, not one. Rewind lives inside a Claude Code session and is cleared out after about 30 days, though a session you come back to and resume can still rewind to its earlier points. Git, your project's own saved history, the record of every version you have chosen to keep, is your project's permanent history, the one that survives closing the terminal, restarting your computer, or coming back next week.

Committing just means telling git "save this version," a habit worth building even if Claude Code does it for you when you ask. Rewind is for "that last stretch went wrong, take me back." Git is for "I want to be able to return to this exact state a month from now."

Use rewind for the first, and keep committing to git for the second. Neither one replaces the other.

Worked example. Three edits into a session, Claude Code starts refactoring a file you never asked it to touch.

claude

Claude Code v0.0.0

Sonnet (200K context) · Claude Pro

~/project

rewind·effort: high
›
Refactoring UserSettings.tsx to use the new hook pattern...
Rewind menu, your prompts this session:
  3. Fix the settings toggle
  2. Add a test for the toggle
  1. Set up the project
Pick a point, then choose: Restore code and conversation
Escape twice, with an empty prompt, opens the rewind menu.

Instead of arguing it back into place, you press Escape twice, see the point right before it wandered, and restore the conversation and code together. You are back to the known-good state, and you re-brief it with the boundary you forgot to name the first time.

claude

Claude Code v0.0.0

Sonnet (200K context) · Claude Pro

~/project

rewind·effort: high
›
Restored. UserSettings.tsx and the conversation are back to right before the refactor started.
You pick Restore code and conversation. One known-good point, restored, and now you re-brief it with the boundary you forgot the first time.

It is also completely normal to just throw a session away. Many practitioners restart a good share of their sessions, not because something broke, but because starting clean was faster than untangling where it drifted. That is routine, not a sign you did something wrong.

Rewind is the undo for the session you are in right now. Git is the memory that outlives it. Know which one you need before you need it.

1

Watch

You type this

Claude Code just started refactoring a file that has nothing to do with what I asked. Press Escape twice, show me the rewind menu, and restore the conversation and code together to the point right before it started that refactor.

Claude does this

Claude Code opens the rewind menu with a short list of earlier points in the session. You pick the one right before the unwanted refactor, restore both the conversation and the code, and the session is back to a known-good state, with nothing about the wandering edit left behind.

Why this works

  • Press Escape twice

    an empty prompt box is what opens the rewind menu; the same two presses, with text still typed, would only clear your draft.

  • restore the conversation and code together

    naming both means you get back the exact state, not just the chat history with the unwanted file changes still sitting there.

2

Your turn

What actually gets that file back

Now a different moment. Earlier in this same session, Claude Code ran a shell command that deleted a file you needed. You want that file back. Rewind or ?

Rewind only tracks edits made through Claude Code's own file-editing tool. A deleted-by-command file is a different kind of problem.

Give it a try first. It sticks better than reading the answer cold.

3

On your own

Think of one real Claude Code session that went sideways recently, even a small one. Write three lines: what went wrong, whether rewind alone would have fixed it or you needed git too, and one habit you'll change (committing more often, or reaching for rewind sooner) because of it.

  • I described a real session, not a hypothetical one
  • I correctly judged whether rewind alone would have covered it
  • I named one concrete habit I'll actually change

Your takeaway

Loading your card…

Agentic Levels

Session-Gone-Sideways Rescue Card

From “Undo without panic” · agenticlevels.com

A pocket rescue card for the moment a session drifts: when to rewind, when to restart, and when only git can save you.

1. What went sideways
 
2. Your restore point
 
3. Did a shell command run
 
4. Rewind or restart
 
5. Committed to git
 
6. Your own rule for choosing rewind versus just restarting the whole session
 
7. The first thing you'll do differently the next time a session drifts
 
8. One sentence on why you'll still commit to git, even now that you know rewind exists
 

Keep this for your next project. The habit is the point.

agenticlevels.com · claude-code-m1-04 · Jul 20, 2026

When this breaks

  • Breaks when you trust rewind to undo a shell command's side effects, because it only tracks Claude Code's own file edits.
  • Breaks when nothing was ever committed to git, because a closed session takes its rewind history with it.

You can now

✓

You can open the rewind menu and choose what to restore

  • ✓You can say what rewind does not cover, specifically
  • ✓You can tell session-level undo apart from git's permanent history
  • ✓You do not treat restarting a session as a personal failure

Try it from memory

Pulling this out of your own head now is the part that actually moves it into long-term memory. Re-reading just feels like it does.

Without scrolling up, name the keybinding that opens the rewind menu, and the one category of change it cannot undo.

Tap to see one good answer

Escape twice, with the prompt box empty. It cannot undo changes made by shell commands, like rm or mv, or by any program other than Claude Code's own file-editing tool. That gap is exactly why git still matters even after you've learned to rewind.

Key takeaways

Esc-Esc opens a real undo for this session's conversation and code. It cannot undo shell commands or other programs, and it clears out after about 30 days, so git still owns your permanent history.

  1. 1Escape twice, with an empty prompt, opens the rewind menu.
  2. 2Rewind only tracks edits Claude Code made through its own file-editing tool, not shell commands or other programs.
  3. 3Session undo is temporary. Git is permanent. Use both, for different reasons.
  4. 4Restarting a session that went sideways is routine, not a mistake.

AI can help with this

You do not have to argue a session back on track. Clear the prompt box, press Escape twice, and pick the point right before things went wrong. Claude Code hands you a clean rewind menu instead of a fight, so going back is one press away, not a crisis.

A rewind point and a separate permanent git card sit side by side, with the golden dot on the restored session.

Go deeper

  • Claude Code interactive mode
  • Claude Code common workflows

Was this helpful?

Up nextbecause you now know how to recover when a session goes sideways. Next you write down the repo rules that keep it from wandering off course in the first place.Write CLAUDE.md for the repo→

Related lessons

Move context without driftWrite a task brief Codex can finishWhat Claude Code actually is: one tool, several surfaces
← Back to Claude Code Fundamentals