- 1
Open reflog
git reflog - 2
Find desired HEAD
git show <reflog-sha> - 3
Restore via branch
git checkout -b recovery/<name> <reflog-sha>
Common mistakes
- Running gc aggressively before recovery.
Related commands: git reflog, git checkout -b
Find and restore commits after reset/rebase mistakes.
Open reflog
git reflogFind desired HEAD
git show <reflog-sha>Restore via branch
git checkout -b recovery/<name> <reflog-sha>Common mistakes
Related commands: git reflog, git checkout -b