Blog//BearDrive team/.md

How to undo Claude Code changes: /rewind, checkpoints, Git and file history

Run /rewind, or press Esc twice on an empty prompt, pick the prompt you want to go back to, and choose Restore code, Restore conversation, or both. Checkpoints cover edits made by Claude's file editing tools in that session. Files changed only by Bash commands, many subagent edits, and edits from other sessions or from you outside Claude Code are usually not restored. Claude Code's docs point to version control such as Git for Bash-only and subagent changes. Use Git for code in a repository, and for docs and notes outside Git, a folder that keeps its own file history, such as BearDrive's bdrive restore.

Short answer

Table of three ways to undo Claude Code changes: checkpoints with /rewind (Claude's file-tool edits in this session, not Bash-only files, many subagent edits or other sessions, about 30 days), Git (tracked files in the repository, back to the last commit), and a synced folder's file history such as bdrive restore (files in the folder from any agent, shell or teammate, not code you keep in Git). Checked Nov 12, 2026.

Claude Code has an undo built in: checkpoints, opened with /rewind. It is a quick way back from a bad turn, mainly for changes Claude's file tools made in that session. It also has limits that Claude Code's own documentation spells out. This guide covers how /rewind works, what it leaves behind, and the two tools that pick up the rest: Git for code, and file history for the documents your agents write outside a repository. Everything below was checked against the current docs on November 12, 2026.

How do I undo Claude Code's last change?

Run /rewind, or press Esc twice when the prompt input is empty (Claude Code docs). The menu lists the prompts you sent in the session. Pick the point you want, then choose:

A few details that matter when you rely on it:

To branch off and try a different approach while keeping the original session intact, the docs point to /branch or claude --continue --fork-session.

What doesn't /rewind undo?

The checkpointing docs list these gaps (Claude Code docs):

The docs sum it up themselves: checkpoints are for quick, session-level recovery, and for permanent history you should keep using version control such as Git.

How do I revert what /rewind can't reach?

If the files are in a Git repository, Git is the next layer:

Git can only return you to a state someone committed, staged or stashed. A habit that makes it work well with an agent: commit before a prompt that will touch many files. Then you can see a bad run with git status and git diff and undo it with git restore --source=HEAD --staged --worktree <path> for the files you want back (plus git clean for new files), even if half of it happened through Bash.

What about files that aren't in Git?

Agents also write files that aren't code in a repository: specs, meeting notes, research, memory files, client reports, a team wiki, sometimes in a folder that several people's agents share. Checkpoints still cover what Claude edits with its file tools in your current session, but not what another session, another agent or a teammate wrote. Git helps only if those files live in a repository and someone commits them, and it can only take you back to what was committed, staged or stashed.

That layer needs a folder that keeps history by itself. BearDrive, which we make, is one option: it syncs a folder between teammates and agents and keeps the history of every file in it, whether the change came from Claude, a Bash command, another agent or a teammate on another machine, as long as BearDrive is syncing that device.

Illustration: a BearDrive History run card for one Claude Code session lists the files it edited and created, and the Undo this run confirm shows each path returning to its pre-run content or being removed, with one file a teammate changed after the run flagged.

Two limits to know. File history covers only files inside the synced folder and not ones excluded by .bdriveignore. And BearDrive records a version each time it syncs a change, so several quick writes between syncs can arrive as one version. For code, keep using Git; file history is for the files Git doesn't hold.

A routine that covers all three

Checklist for undoing agent changes: commit before a big prompt, /rewind right after a bad turn, git diff and bdrive log for what rewind missed, prefer the Edit tool over sed, and raise cleanupPeriodDays for old sessions.

Which one should you use?

Questions

How do I undo in Claude Code?
Run /rewind, or press Esc twice on an empty prompt. Pick the prompt you want to return to and choose Restore code, Restore conversation, or Restore code and conversation.
Can /rewind undo changes made by Bash commands?
Only for files Claude had already edited with its file editing tools in that conversation. A file that only Bash commands changed isn't tracked and stays as it is. Claude Code's docs recommend version control such as Git for those.
How long do Claude Code checkpoints last?
Claude Code keeps file snapshots for the 100 most recent checkpoints in a session, and deletes a session's snapshots about 30 days after the session last saved one. The cleanupPeriodDays setting changes that.
Does /rewind undo a subagent's edits?
A forked skill running in the foreground, yes. Other subagents, including background forked skills, can leave edits to files Claude hadn't edited itself, and rewinding doesn't restore those. Use Git to revert them.
How do I undo changes to files that aren't in Git?
You need something that keeps history for that folder. In a BearDrive folder, bdrive restore <file> puts the previous version back, bdrive restore --list <file> shows older versions, and Undo this run in the hub reverts everything one agent session changed.

BearDrive keeps a folder in sync across every teammate and every agent.

Start freeMore posts