How to undo last commit [duplicate]

I did the following comments

git add /file1/path
git rm /file/path
git commit -m "message"

how do I undo my last commit using git?

Like I don't want to have those files committed.


Warning: Don't do this if you've already pushed

You want to do:

git reset HEAD~

If you don't want the changes and blow everything away:

git reset --hard HEAD~