Git: Undo git reset
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
Written by Daniel Schmidt
Related protips
1 Response
@daniel schmidt
I don't think this works as you mentioned
resetting to particular commit from reflog works
but git reset HEAD@{1} after doing git reset HEAD~1, doesn't make sense to me
and didn't undo the reset
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#