DEV Community

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

Posted on • Originally published at melvingeorge.me

2 1

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 😃.


Heroku

Deliver your unique apps, your own way.

Heroku tackles the toil — patching and upgrading, 24/7 ops and security, build systems, failovers, and more. Stay focused on building great data-driven applications.

Learn More

Top comments (0)

Jetbrains image

Build Secure, Ship Fast

Discover best practices to secure CI/CD without slowing down your pipeline.

Read more

👋 Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s day—drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay