Join the Stack Overflow Community
Stack Overflow is a community of 6.3 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

This question already has an answer here:

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.

share|improve this question

marked as duplicate by Holger Just, Kate Gregory, alex, doitlikejustin, Lego Stormtroopr Oct 11 '13 at 0:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
You've got the answer here, after a 2sec search... ;-) stackoverflow.com/a/927386/1266697 – Jeje Doudou Oct 10 '13 at 18:55
    
I'm unhappy with these questions and answers. They're often very vague. Does the user wish to simply undo the git commit (and leave the working tree unmodified?), or do they wish to also revert the working tree? – Aaron McDaid Aug 30 '14 at 22:47
up vote 42 down vote accepted

You want to do:

git reset HEAD~

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

git reset --hard HEAD~
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.