Question:
How to undo/remove the last pushed commit:
Answer:
git push -f origin HEAD^:master
Question:
How to undo/remove one specific pushed commit:
Answer:
- git log to find out the commit you want to revert
- git push origin +xxxxxx (commit number):master while xxxxxx is the commit number before the wrongly pushed commit. + was for force push
Question:
How to undo/remove a specific pushed commit:
Answer:
git reset ––hard xxxxxxx (commit number)
git push ––force
WARNING: This will rewrite the commit history as well
The question and answer are referred from Stackoverflow