AnonymousJan 04, 2024
In this post, you will learn how to Undo & redo recent commits in git.
If you just want to undo your last commit, you can use:
$ git reset --soft HEAD^
If you want to completely get rid of the changes introduced in the last commit, you can use:
$ git reset --hard HEAD^
$ git reset --hard HEAD~3
If you want undio Multiple commits then you can use HEAD~2,3,4
and so on.
$ git add .
$ git commit -c "your message"
$ git push origin <branch-name>