2 ms·
> Last but not least, when everything goes wrong, the single command that can take you out of any weird situation is `git reflog` which shows you all the commit
by Terr_ 3y ago
> Last but not least, when everything goes wrong, the single command that can take you out of any weird situation is `git reflog` which shows you all the commits
that HEAD has pointed to.
And if you're feeling extra-paranoid like me, a `git rev-parse HEAD` and copying that string down somewhere safe before embarking on a tricky process with lots of merge-conflicts or other shuffling.
It's nice to have confidence that I've accurately identified which state is the last-known-good one--not one a few steps too far into the chaos-zone--and that I can usually get back to if everything goes to hell. (Barring unwise use of stuff like `git gc` or `git filter-branch`.)
- olvy0 3y agoOr putting a temporary tag on the current HEAD, so there's something I can return to later.