Your working directory is unchanged. The snapshot is saved, but you keep working normally.
4
Continue working
Make more changes, try a risky refactor, or switch branches:
# Modify files furtherecho "// Risky refactor" >> src/app.jsecho "// More changes" >> src/helper.js# Check statusgit status
5
List your snapshots
See all snapshots for the current repository:
git-snapshot list
Output:
Snapshots for your-project: before-refactor (a1b2c3d4) branch: main | created: 2026-03-03 14:30:52
6
Restore the snapshot
If things go wrong, restore your checkpoint:
git-snapshot restore before-refactor
Output:
Warning: You have uncommitted changes that will be overwritten!Are you sure you want to continue? [y/N] yRestoring snapshot: before-refactor.a1b2c3d4Discarding current changes...Restoring 1 staged file(s)...Restoring 1 untracked file(s)...Snapshot restored successfully!
Your working directory is now exactly as it was when you created the snapshot:
src/app.js is staged with the original changes
src/helper.js is untracked with the original content
# Delete a specific snapshotgit-snapshot delete before-refactor# Delete multiple snapshotsgit-snapshot delete snapshot1 snapshot2 snapshot3# Delete all snapshots for current repogit-snapshot prune
Deletion is permanent. Make sure you don’t need the snapshot before deleting.
# Save current work with preserved staginggit-snapshot wip# Switch to another branchgit checkout hotfix-branch# ... fix the bug ...git commit -m "Fix critical bug"# Return to original workgit checkout maingit-snapshot restore wip# Continue where you left off - staging intact
# Try approach Agit-snapshot approach-a# ... make changes ...# Try approach B insteadgit-snapshot restore approach-agit-snapshot approach-b# ... make different changes ...# Compare results by restoring eachgit-snapshot restore approach-a # see approach Agit-snapshot restore approach-b # see approach B
# Working on feature, stage what's readygit add src/feature.js# Snapshot the staged workgit-snapshot feature-staged# Continue with unstaged experimentsvim src/feature.js# Oops, experiments broke everythinggit-snapshot restore feature-staged# Back to the good state, staged file still staged
Important: Restoring a snapshot will overwrite your current working directory. Any uncommitted changes will be lost unless you create a snapshot first.
When you restore a snapshot:
Staged files are restored to the staging area
Unstaged files are restored as working tree modifications
Untracked files are restored as untracked
Current changes are discarded (you’ll be prompted to confirm)
# Always safe: create a snapshot before restoringgit-snapshot current-stategit-snapshot restore old-state# If you don't like the old state, go backgit-snapshot restore current-state