Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Claude Code Checkpoints

Claude Code Checkpoints

Checkpoints are Claude Code'scode safety rollback tool, which automatically tracks Claude's file edits, helping you quickly undo unwanted changes and avoiding difficulty recovering after code is broken.

How checkpoints work

Checkpoints runautomatically in the backgroundwhile you use Claude Code, with no manual configuration required:

  1. Automatic creation: after each user prompt, a checkpoint is automatically created to record the current code state
  2. Persistent storage: checkpoints are preserved across sessions; even if you close a session, you can still access historical checkpoints after resuming
  3. Automatic cleanup: checkpoints older than 30 days are automatically deleted (the cleanup period is configurable)

Note: only direct modifications made by Claude through file editing tools are tracked; changes made in other ways are not recorded.


How to use checkpoints to roll back changes

1. Open the rollback menu

There are two ways to trigger it; choose either:

2. Select the rollback type

After opening the menu, you can choose from three rollback modes as needed:

Rollback type effect Applicable scenarios
Conversation only Roll back to historical conversation content, keeping current code changes When the conversation seems off track and you want to ask again, but the code changes are fine
Code only Restore files to a historical state, keeping the current conversation When the code is broken but you want to continue adjusting based on the current conversation
Code and conversation Roll back both code and conversation to a previous state When you want to start completely over and return to a satisfactory point

Common use cases

Checkpoints are especially suitable for the following development scenarios:

  1. Explore multiple approaches: try different code implementation ideas; if unsatisfied, roll back to the starting point with one click and try another approach
  2. Quickly fix mistakes: when Claude's changes introduce bugs or break functionality, quickly roll back to the working state before the change
  3. Iterative feature development: run multiple variant experiments on a feature and restore to a stable intermediate version at any time

Important limitations

Checkpoints are atemporary safety net, not a cure-all; be aware of their boundaries:

Changes made by Bash commands are not tracked
Operations like rm mv cp executed via the Bash tool are not recorded by checkpoints and cannot be rolled back.

External changes are not tracked
Only files edited by Claude within the current session are tracked. Files you modify manually in external tools like VS Code or the terminal, or changes from other sessions, are not captured.

Cannot replace version control tools
Checkpoints are only fortemporary session-level rollbacks, not suitable for long-term project management and team collaboration.