#claude-code#undo#ai-coding#version-control

How to Undo in Claude Code: Every Method Explained

Complete guide to undoing changes in Claude Code. Learn /rewind, checkpoints, ccundo, and automatic snapshot tools.

Claude Code just rewrote half your project. The changes looked good in the diff, but now nothing works. Here’s how to get back to a working state.

This guide covers every method, from built-in rewind to automatic snapshot tools like mrq.

Built-in Rewind (Fastest Method)

Claude Code v2.0+ has built-in checkpointing with a rewind feature.

To activate:

  1. Press Esc twice quickly, or
  2. Type /rewind in the command bar

You can restore:

  • Conversation only: Roll back the chat but keep code changes
  • Code only: Revert files but keep conversation context
  • Both: Full rollback to a previous state

This is the fastest way to undo recent Claude Code changes. The limitation is that checkpoints are tied to conversation turns, so you can only rewind to specific points.

ccundo (Community Tool)

For more granular control, the community-built ccundo tool lets you undo specific operations.

Install:

npm install -g ccundo

Usage:

# See what operations happened
ccundo list

# Preview what would be undone
ccundo preview

# Undo the last operation
ccundo undo

ccundo reads Claude Code’s session files directly, so you can selectively undo specific file changes without affecting others.

Git: The Reliable Fallback

If you’re using Git (and you should be), you can always fall back to it:

# See what Claude changed
git diff

# Discard all uncommitted changes
git checkout .

# Or stash changes if you might want them later
git stash

The catch: This only works if you committed before Claude made its changes. If you were iterating quickly and hadn’t committed yet, Git can’t help you.

The Problem with Manual Approaches

All of these methods require you to do something:

  • Rewind: Remember to use it before too many turns pass
  • ccundo: Know it exists, have it installed
  • Git: Commit before every Claude interaction (who does that?)

When you’re in flow with Claude Code, experimenting with different approaches, the last thing you want is to stop and think about version control.

Automatic Protection: Set and Forget

mrq takes a different approach. Instead of requiring action, it just watches.

Setup (once):

npm install -g mrq-cli
mrq login
mrq watch

Now every file change is captured automatically. No commits, no checkpoints to manage, no decisions.

When Claude breaks something:

# See what happened
mrq history

# Go back to any point
mrq restore abc123

mrq captures changes every few seconds while you work. So even if Claude makes a change, you accept it, realize it’s wrong, and Claude makes three more changes before you notice, you can still go back to exactly where you were.

Comparison

MethodWhen It WorksWhen It Fails
/rewindRecent changes, within sessionOld sessions, specific file recovery
ccundoGranular operation undoRequires manual intervention
GitCommitted codeUncommitted experiments
mrqAlwaysRequires initial setup

Our Recommendation

Use Git for intentional milestones (“feature complete”, “before major refactor”).

Use mrq for continuous protection between commits. It runs alongside Git, not instead of it.

That way, you get the best of both: intentional version history for collaboration and deployment, plus automatic snapshots for recovering from AI chaos.

Summary

Claude Code’s built-in rewind is great for quick undos within a session. ccundo gives you more control. Git is your safety net for committed code.

For protection that doesn’t require thinking about it, automatic snapshotting tools like mrq capture everything as you work. You can iterate as fast as Claude can code, knowing you can always recover.


mrq captures every file change automatically while you code with AI. One command to start, instant recovery when things break.

Written by mrq team