Reset, Revert & Clean
You ran git reset once and lost an afternoon of edits, then ran almost the same command another day and nothing bad happened at all. Undo in git is really three separate tools wearing one word.
- ▸One undo command makes commits vanish from your branch, yet they wait intact on disk until garbage collection runs.
- ▸Another undo grows history instead of shrinking it, appending a fresh commit that is the exact opposite of a mistake.
- ▸Only the third truly destroys anything: it deletes files git never saved, and no reflog can bring those back.
git reset, git revert, and git clean all answer the same panicked question: *how do I take that back?* They are not three names for one action. Fire the first and a mistake disappears as if it never happened. Fire the second and the mistake stays visible in your log, now followed by a commit that cancels it out. Fire the third and a file you were counting on is simply gone from disk.
The difference comes down to two questions you can ask of any undo. First, *what does it touch*: the record of commits, the files you have edited, or both? Second, *what happens to the length of your history*: does it get shorter, longer, or stay exactly the same? Each of these commands answers those two questions differently, and picking the wrong one is how an afternoon of work disappears.
Across the next few screens you will fire each command on the same small project, drive one of them through its settings, undo a merge, and then try to recover everything you destroyed. Watch what each touches, watch the history grow or shrink, and watch which damage can be walked back.