Undoing an error
If you did something wrong which will probably happen it is easy to replace local changes using
git checkout -- filename
This code will replace the changes in your working directory with the latest content from this file in the Head, anything that is in the index will be kept.
If you want to start over from the latest commit again, simply fetch everything from the remote repository again using
git fetch origin
Then point your local master branch at it again with
git reset --hard origin/master