git reset hard and soft

Discard the latest commits with the following command:

git reset --hard HEAD~1
1 is the number of commits to discard.

To make the changes to be still there, but delete the commit use soft reset:
git reset --soft HEAD~1
1 is the number of commits to discard
--soft is the default option