Undoing Git mistakes: the decision tree
In Git almost nothing is lost. A calming decision tree for reset, revert, stash and reflog, anchored to a visible undo.

Almost everything in Git can be undone
The most important sentence first: in Git, almost nothing is truly lost. Commits you think you deleted are often still there and can be brought back. That safety takes away the fear. The reason mistakes still cause panic is not danger but uncertainty about which of the many commands is the right one.
This decision tree sorts the most common situations. First ask where the mistake sits, and the right path almost follows on its own.
I have not committed yet
The change is only in the working directory. If you want to discard it entirely, you reset the file to the last state (checkout or restore). If you only want to set it aside briefly to do something else, you use a stash. The stash is a safe holding area from which you retrieve the change later.
I committed too early or wrong
The commit is made but not pushed yet. If you only want to fix the message or content of the last commit, amend is the way. If you want to dissolve the commit and bring the changes back into the working directory, you use a soft reset. The commit disappears, your work stays.
I already pushed
As soon as others might have the commit, an important rule applies: do not rewrite the history anymore. Instead of deleting the commit, you undo its effect with a revert. Revert creates a new commit that cancels the change without destroying the shared history. That keeps everyone on the team in sync.
I deleted something and want it back
Here the reflog helps. Git keeps a log of everywhere HEAD has been. Even a commit that a hard reset seemingly destroyed usually still shows up there and can be restored. The reflog is the safety net that many people do not know about.
The decision tree in short
- Not committed yet, discard: reset the file.
- Not committed yet, keep for later: stash.
- Last commit wrong, not pushed: amend or soft reset.
- Already pushed: revert, do not rewrite history.
- Something seemingly lost: reflog.
Why a visible undo is worth so much
These commands are powerful, but their names are not very intuitive, and the wrong switch feels dangerous. This is exactly where a good interface helps. Spire makes many of these steps accessible as a visible undo, so you can take back an action without knowing the right Git command by heart. That lowers the barrier to trying anything at all, and trying things is half the battle when learning Git.
To stay honest: a tool does not replace understanding. But it gives you the courage you need to build that understanding calmly.