Git: Undo a commit

git reset --hard HEAD~number_of_last_commits

Or

git reset --hard commit_id

If the commits are on the server

git push --force