How to Discard Last Commit in Git after Push
In this example, I will show you how to revert last commit in git after push. Sometimes we need to discard last commit in git and if you don't know how to do it then this example is for you.
From this example, you will learn how to discard last commit in git. To get git revert last push, just run those below commands:
// Go to previous commit git reset --hard HEAD~1 //or run git reset --hard HEAD^ // Force push git push -f
Hope it can help you.