What is `ORIG_HEAD` and how can it save you?
AdvancedConceptMerge, rebase and cherry-pick
Answer
Git saves the previous tip of HEAD in ORIG_HEAD before dangerous operations (merge, rebase, reset, pull). After a bad rebase or merge you can return to the pre-operation state.
git reset --hard ORIG_HEAD
More on Merge, rebase and cherry-pick
What is the difference between a fast-forward merge and a merge commit?BeginnerHow does a three-way merge work?IntermediateWhat does `git rebase` actually do?IntermediateMerge versus rebase: how do you decide?IntermediateWhat are squash merge, merge commit and rebase-and-merge on GitHub?IntermediateWhy does a squash-merged branch show as unmerged to `git branch --merged`?Intermediate