Get rid of Git commit

Get rid of Git commit

Did you commit your changes in Git? Have you pushed too?? I know how it feels! Absolutely confused.
Most of the times it happens once you send the pull request and the reviewer comes along and says sorry you need to revert your code there are some issues with that!!!!!!
Dont worry about that since there is a simple command you can use to revert your changes.

Revert the last commit in your origin

git reset --hard HEAD~1

Have a look at Gir repo and see the list of commits in the branch you pushed your code.

Revert one of the random commits

revert commit hashnumber

then it will create a new revert commit on the top of your branch and you need to push the new reverted commit.