How to undo from 'git reset' command?

January 5, 2021 - 1 min read

To undo a git reset, you can use the command

git reset 'HEAD@1'

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

command. This will show all the activities including reset.

Feel free to share if you found this useful 😃.