Skip to content

Instantly share code, notes, and snippets.

@greew
Created March 21, 2017 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greew/8551d1d7444ed56a5dc50e3f7c92069d to your computer and use it in GitHub Desktop.
Save greew/8551d1d7444ed56a5dc50e3f7c92069d to your computer and use it in GitHub Desktop.
Git - Recover lost commit
# Get a list of where HEAD has been recently
git reflog
# Check the sha1 where you think the correct code might be
git show <sha1>
# When you've found it, merge it back in
git merge <sha1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment