Git topic
Getting out of trouble
Learn how to undo mistakes and recover work you thought was lost.
Look it up and watch it run
From the Animated Git Cheat Sheet
24 commands on this topic, each drawn by git-sim on a small sample repository.
git clean -f
Find the commit that broke something
git bisect start <bad> <good>
Force-delete an unmerged branch
git branch -D <name>
Abort a conflicted merge
git merge --abort
Abort a rebase
git rebase --abort
Force-push over the remote
git push --force
Apply and remove the latest stash
git stash pop
Delete a stash
git stash drop
The commands, played on a real repository
Pick a command to watch it happen. Each one shows its risk rating; the ones with a full page link to the before and after, whether it is safe, and how to undo it.
How to use this page
- slider / ▶Drag the slider, or press play, to watch the command happen. Before and After jump to either end.
- ← → · spaceStep through a multi-step command; space toggles Before / After.
- APlay or pause the loop (the page opens playing). Any manual input takes over.
- hoverA commit shows its message, author, date and parents, with its history highlighted.
- clickCopies the commit sha.
- ctrl + wheelZoom around the cursor (pinch on a trackpad). Double-click resets the view.
- EscStop playback, reset the view, close this menu.
- shareThe Share button copies a link to this graph, copies it as an image, downloads PNG/SVG/page, or posts it. #before, #after or #step=N in the link pins the state.
Pick a command to watch it happen on a small sample repository.
git
safe
Sample repository: . Drag the slider or press play; hover a commit for its details.
Read the full page
Practice it in Level 1
Try it on your own repository: git-sim
Every command plays on the same repository, so they are easy to compare.
No command matches that. Try a shorter word, or another danger level.
- Safe reads or only adds; nothing is lost
- Caution moves or rewrites things; recoverable from the reflog
- Destructive can lose work for good
Watch them in the git-sim viewer
Each demo plays step by step, with the before and after side by side.
git restore <file>git restore --staged <file>git reset --hard <commit>git revert <commit>git refloggit stashgit clean -fd
Every command in one place: the Visual Git command reference.
Learn how it works
Workflow demos
A few commands in a row, the way you'd use them on a real project.
Try it in your own repos
git-sim
See what a command will do to your repo before you run it. It reads the repository and draws the result without changing anything.
git-sim refloggit-sim reset --hard <commit>git-sim branch <name> <commit>
It can also pre-flight a risky command as you type it, and follow your repo live while you or an AI agent work in it.
git-dummy
Make a throwaway repo shaped for this topic, then practice on it without risking real work.
git-dummy --scenario detached-head --name practicegit-dummy --scenario merge-conflict --name practice
Then cd practice and run any of the git-sim commands here.
Want to see your repo a whole new way? Devlands turns it into a 3D world you can walk through.





