e8oqzg
Last Updated: May 11, 2016
·
25.17K
· dsci

Git: Undo git reset

git

If you did something like

git reset HEAD~1

sometime you want to undo this. There is no need to cry, Git keeps a log of all ref updates.

To see them:

git reflog

The output may something like that

39ab761 HEAD@{0}: reset: moving to HEAD~1
b55c098 HEAD@{1}: Change skirt length ...

With

git reset HEAD@{1}

we undo our mistake and we are back at the commit before reseting.

Also possible:

git reset b55c098

1 Response
Add your response

17979

THIS SAVED MY LIFE. Okay, well not literally, but I appreciate it :)

  • Patrick patcanella.com
over 1 year ago ·