Let's say you've performed two committed and pushed them by mistake.Now you found out that commit XXXXX was before those wrongful commits. Then force push the last perfect commit as the new master.
Step 1: Find out the commit you want to revert using the following command:
git log
Say, XXXX is the commit before the wrongly pushed commit.
Step 2: Force push the commit as the master
git push origin +XXXXX:master
Here, + is used for force push
For more information please go through the following tutorial to get more info about git: