Getting out of trouble: lessons, commands and guides | Learn Git

Git topic

Getting out of trouble

Learn how to undo mistakes and recover work you thought was lost.

Explore

Look it up and watch it run

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.

git-sim

Pick a command to watch it happen on a small sample repository.

Every command plays on the same repository, so they are easy to compare.

  • 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.

Every command in one place: the Visual Git command reference.

Learn

Learn how it works

Develop

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.