`git reflog`, which the article prominently mentions, really should be the VERY FIRST thing to teach everyone who is learning git.<p>If you don't know about it, it is well worth checking it out now.<p>It is your one ticket to getting to whatever previous, good (or bad!) state you were at any point before[1]. The only thing it cannot help you recover is locally made changes that you never committed to anything at any point, and have since locally deleted. This is surprisingly rare, at least for me, as I just tend to `git stash` stuff I don't want anymore.<p>With `git reflog` in your backpocket, you can rebase, merge, branch, delete branches, cherry-pick, rewrite history, whatever, all to your heart's content. `git reflog` keeps a journal of every single action, and tells you the HEAD before and after each action, which you can then simply checkout or `reset --hard` your branch to.<p>I never even use any arguments with it, I literally just `git reflog`.<p>[1] Unless garbage collection has deleted the commit you were pointing to, I guess, but I've never had to use `git reflog` <i>that</i> far in the future.