git reset --hard <commit> moves the current branch and overwrites the index and working tree. Aimed at the wrong commit, it appears to delete work; here it throws away the three most recent commits on main:
git reset --hard HEAD~3
git reflog -2 main
git reset --hard main@{1}Output
HEAD is now at f2b4106 Allow prices up to 999,999.99
f2b4106 main@{0}: reset: moving to HEAD~3
035e659 main@{1}: commit: Restore cents in prices: NUMERIC(8) meant whole dollars
HEAD is now at 035e659 Restore cents in prices: NUMERIC(8) meant whole dollarsThe reset is itself a reflog entry, so main@{1}, the position before it, undoes it. ORIG_HEAD works too, but only until the next reset, merge or rebase overwrites it. Prefer main@{1} to HEAD@{1}, since HEAD's reflog also records every branch switch. What a hard reset really destroys is uncommitted work, so check git status first, or use git reset --keep, which refuses to overwrite local changes.