Retrieve lost HEAD branch in git

Here is what worked for me:

  1. Use git reflog command to find out the head version that disappeared.
  2. Use git checkout @{-1} to move HEAD back to the one disappeared. The number -X is how many commits the disappeared from current head. -1 means the disappeared version is 1 commit away from current HEAD.
  3. Create a branch to save the disappeared version

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)