Git topic
Rewriting history
Learn how to change and clean up commits you've already made.
Look it up and watch it run
From the Animated Git Cheat Sheet
15 commands on this topic, each drawn by git-sim on a small sample repository.
git rebase <branch>
Edit, squash or reorder your commits
git rebase -i <base>
Move part of a branch to a new base
git rebase --onto <new-base> <old-base>
Continue a rebase after fixing conflicts
git rebase --continue
Skip the conflicting commit in a rebase
git rebase --skip
Abort a rebase
git rebase --abort
Copy a commit onto your branch
git cherry-pick <commit>
Copy a range of commits
git cherry-pick <from>..<to>
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 commit --amend --no-editgit reset --hard <commit>git rebase <branch>git cherry-pick <commit>git revert <commit>git reflog
Every command in one place: the Visual Git command reference.
Learn how it works
Levels on this topic
Watch each command happen, step by step, then pick the right one yourself.
- 12 Level 12 Revert Undo the changes from an earlier commit by adding a new commit that does the opposite.
- 13 Level 13 Reset Repoint a branch marker to an earlier commit, and see what Git does with the changes that would be lost.
- 14 Level 14 Rebase Transfer a whole branch of commits onto a new base commit, and learn why that rewrites history.
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 reset --soft HEAD~1git-sim rebase maingit-sim rebase -i main --todo todo.txtgit-sim cherry-pick <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 rebase-ready --name practicegit-dummy --scenario reflog --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.






