How checkpointing works for tracking file changes and rewinding to previous states. Use when user asks about checkpoints, rewinding, rollback, undo, or restoring previous states.
Automatic checkpointing tracks file changes before each prompt, enabling quick rollback of code or conversation history. Use when you need to undo recent changes, try different approaches, or recover from mistakes during development sessions.
/plugin marketplace add reggiechan74/claude-plugins/plugin install claude-code-metaskill@claude-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Claude Code includes an automatic checkpointing system that tracks file edits and allows users to recover from unwanted changes during development sessions.
The system captures code states before each modification.
Key features:
Tracked:
Not tracked:
rm, mv, cp)Keyboard shortcut:
Press Esc twice (quickly)
Slash command:
/rewind
When you open the rewind menu, you have three options:
Keeps: All code changes Reverts: Conversation history to selected checkpoint
Use when:
Keeps: Conversation history Reverts: Files to selected checkpoint
Use when:
Reverts: Everything to selected checkpoint (full rollback)
Use when:
Checkpoints are displayed with:
Navigate with arrow keys and select with Enter.
Scenario: Try multiple implementation strategies without losing starting point.
# Approach 1
"implement feature using strategy A"
# Review, not ideal
# Rewind
Esc Esc → Select checkpoint → Code only
# Approach 2
"implement feature using strategy B"
# Better!
Scenario: Recent changes introduced a bug.
# Make changes
"refactor the authentication module"
# Oops, broke login
# Rewind
Esc Esc → Select checkpoint before refactor → Code only
# Try again differently
"refactor authentication but keep existing login flow"
Scenario: Preserve working states while iterating.
# Working state 1
"add basic user validation"
# Works ✓
# Iterate
"add more complex validation rules"
# Issues found
# Return to working state
Esc Esc → Code only
# Try different iteration
"add regex-based validation"
Scenario: Conversation got confused or went off track.
# Good code changes made
"add user profile endpoint"
"add user settings endpoint"
# Conversation gets confusing
# Want to restart conversation but keep code
# Rewind conversation only
Esc Esc → Conversation only → Select early checkpoint
# Fresh conversation start with code intact
Not captured:
!rm file.txt
!mv old.txt new.txt
!cp source.txt dest.txt
!git checkout -b new-branch
Why: Bash commands run outside Claude's file tracking system.
Workaround:
Not captured:
Workaround:
Limited tracking: If multiple Claude Code sessions modify the same files, only changes from the current session are tracked for checkpointing.
Best practice: Use one Claude Code session at a time per project.
| Feature | Checkpointing | Git |
|---|---|---|
| Scope | Session-level | Repository-wide |
| Duration | 30 days | Permanent |
| Granularity | Per prompt | Per commit |
| Collaboration | Single user | Team |
| Purpose | Session recovery | Version control |
| Bash tracking | No | Yes |
Git for:
Checkpointing for:
Recommended workflow:
# Regular git commits for milestones
git commit -m "Working authentication"
# Use checkpointing for rapid iteration
"try optimization A"
Esc Esc → rewind if not good
"try optimization B"
Esc Esc → rewind if not good
"try optimization C"
# This one works!
# Commit the winner
git add .
git commit -m "Optimized authentication"
Default: 30 days
Configure retention:
Edit .claude/settings.json:
{
"checkpointRetentionDays": 60
}
Not recommended, but possible:
{
"enableCheckpointing": false
}
Look at:
Avoid:
Good (easy to identify):
"add email validation to user registration"
"refactor database queries for performance"
Bad (hard to identify):
"make changes"
"fix it"
Checkpoints show your prompts, so descriptive prompts make checkpoint selection easier.
# Checkpoint for rapid iteration
Try approach → rewind → try approach → rewind
# Git for confirmed changes
git add .
git commit -m "Final implementation"
Often better: Rewind code only and keep conversation history.
Why:
Don't rely solely on checkpoints:
# After significant progress
git add .
git commit -m "Checkpoint: working user authentication"
# Continue with Claude Code
# Checkpointing handles rapid iteration
# Git handles permanent milestones
Possible causes:
Solution:
git loggit diffCheck:
Solution:
/rewind command instead of Esc EscCheck:
Solution:
# Current working state
git commit -m "Pre-refactor checkpoint"
# Try refactoring
"refactor user controller for better error handling"
# Test
!npm test
# If tests fail
Esc Esc → Code only → Return to pre-refactor
# Try different approach
"refactor user controller with focus on backward compatibility"
# If tests pass
git commit -m "Refactored user controller"
# Baseline working
git commit -m "Baseline"
# Experiment 1
"add feature using approach A"
# Review, note pros/cons
# Rewind
Esc Esc → Code only
# Experiment 2
"add feature using approach B"
# Compare, choose better
# If experiment 2 is better
git commit -m "Added feature using approach B"
# If neither was good
Esc Esc → Code only → Back to baseline
# Making good progress
"implement auth"
"add user roles"
"add permissions"
# Conversation gets complex/confused
Esc Esc → Conversation only → Select first checkpoint
# Start fresh conversation
"explain the architecture we just built"
# Code intact, conversation reset