DEV Community

Cover image for How to undo from 'git reset' command?
MELVIN GEORGE
MELVIN GEORGE

Posted on • Originally published at melvingeorge.me

How to undo from 'git reset' command?

Originally posted here!

To undo a git reset, you can use the command

git reset 'HEAD@1'
Enter fullscreen mode Exit fullscreen mode

This will make the Git point to a version before the reset happened.

HEAD@1 means version before reset and HEAD@0 is the last git reset command itself.

This is possible since Git tracks all the activities within a branch including the git reset.

If you want a more detailed look into the activities in a Git branch, you can use the

git reflog
Enter fullscreen mode Exit fullscreen mode

command. This will show all the activities including reset.

Feel free to share if you found this useful 😃.


Top comments (0)