Recovering lost commits with git reflog

There is a particular kind of panic that hits when a commit looks like it just vanished. Maybe you ran a hard reset, or a rebase went sideways, and the work you had a minute ago is nowhere in your history. Before you assume it is gone for good, there is one command that may be able to bring it back: git reflog . What is the reflog? Git keeps a private log of everywhere HEAD has been. Everything…