DEV Community

Yegor Shytikov
Yegor Shytikov

Posted on

Git Rever Last Commit

How to revert code to the previous version:

git reset --hard HEAD~1
Enter fullscreen mode Exit fullscreen mode

or soft if you don't need to keep the change:

git reset --hard HEAD~1
Enter fullscreen mode Exit fullscreen mode

Also, you can reset all changes by command:

git checkout HEAD 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)