Possible Duplicate:
Git: Revert to previous commit status
I’ve tried some changes in my code but I messed up too many things (never work when you’re tired and it’s late) and I just want to go back to my last commit. I DIDN’T do git add or git commit and obviously if I do git pull everything is up to date.
I thought that git checkout was what I needed but it didn’t worked.. any help?
The answers mentioning
reset --hardwill do what you want (as well as some other things that you may or may not), but you were correct in thinking thatcheckoutwas the command you needed. The problem is thatcheckoutdoes two different things, so you need to supply it with a path argument:git checkout .
from the root of your repository will do you just fine.