Question: I messed up badly my code and I want to revert it to the last commit.

I'm doing `git status` and I see that I changed a lot of files. I don't want to see them at all. So I did `git log` and found out the hash of last commit. 

I used this hash in command: `git fetch origin this_hash` and got the message:

```
Mig-macbook-air:ios M$ git fetch origin this_hash
From https://github.com/linkto/myrepo
 * branch            this_hash -> FETCH_HEAD

```

but then when I do `git status` I still see broken files, also I see them in my IDE. I want to completely get rid of those changes, how can I do it?

I didn't do push on the last commit; I just created a branch and did a commit.

Answer: 
If you see all the files when running `git status`, that means you have a lot of local changes that are **not** committed. If you are sure you want to get rid of those changes, run `git reset --hard head`.
`git fetch` just fetches more commits from a remote; it doesn't touch the working directory.

You want `git checkout <commit-reference>`, which will check out that version into the working directory.