v2/examples/git-checkpoint-demo.md
This example demonstrates how to use the automatic Git checkpoint system with Claude Code.
# Run the setup script
./.claude/helpers/setup-checkpoints.sh
# Choose option 1 for simple checkpoints or option 2 for advanced features
Before editing any file, Claude automatically creates a checkpoint:
.claude/checkpoints/After editing a file, Claude:
When you submit a new task, Claude:
When ending a Claude session:
# 1. Start Claude Code with checkpoints enabled
claude --settings .claude/settings-checkpoint-simple.json
# 2. Work on your project
# Claude will automatically create checkpoints
# 3. List all checkpoints
git tag -l 'checkpoint-*' | sort -r
# 4. View checkpoint details
./.claude/helpers/checkpoint-manager.sh show checkpoint-20240130-143022
# 5. Compare current state with a checkpoint
./.claude/helpers/checkpoint-manager.sh diff checkpoint-20240130-143022
# 6. Rollback to a checkpoint if needed
./.claude/helpers/checkpoint-manager.sh rollback checkpoint-20240130-143022
# List all checkpoints
./.claude/helpers/checkpoint-manager.sh list
# Show checkpoint details
./.claude/helpers/checkpoint-manager.sh show <checkpoint-name>
# Rollback to checkpoint
./.claude/helpers/checkpoint-manager.sh rollback <checkpoint-name> [--branch|--reset|--stash]
# Compare with checkpoint
./.claude/helpers/checkpoint-manager.sh diff <checkpoint-name>
# Clean old checkpoints
./.claude/helpers/checkpoint-manager.sh clean [days]
# Generate summary report
./.claude/helpers/checkpoint-manager.sh summary
Branch Rollback (safest):
./.claude/helpers/checkpoint-manager.sh rollback checkpoint-20240130-143022 --branch
Creates a new branch from the checkpoint
Stash Rollback (reversible):
./.claude/helpers/checkpoint-manager.sh rollback checkpoint-20240130-143022 --stash
Stashes current changes before resetting
Hard Reset (destructive):
./.claude/helpers/checkpoint-manager.sh rollback checkpoint-20240130-143022 --reset
⚠️ Permanently discards current changes
With the advanced configuration, you can:
Enable by setting:
export CREATE_GH_RELEASE=true
The system uses the checkpoint-hooks.sh script which can be customized:
checkpoint-manager.sh clean 7 to remove checkpoints older than 7 days.claude/checkpoints/summary-*.md files for session overviews.claude/checkpoints/*.jsonjq is installedgit tag -l--stash option to save current workjq '.' .claude/settings.json