git reflogはブランチのHEADがどこにあったかを記録します — すべてのコミット、チェックアウト、リセット、リベース等です。これは失われたコミットの復旧(不適切なリセット、リベース、またはブランチ削除後に)のための安全ネットであり、消えたように見えますが依然として復旧可能です。
reflogとは
The REFLOG logs every movement of HEAD (and branch tips) in YOUR local repo:
→ every commit, checkout, reset, rebase, merge, etc. is recorded with a reference
→ it's LOCAL and includes commits not reachable from any branch (the "lost" ones)
→ Even if you reset/rebase away commits, reflog remembers where they were.
失われた作業の復旧
git reflog
git checkout def456
git branch recovered def456
git reset --hard def456
