One of the great things about GIT. Is that you cannot really make a mistake or in other words any mistake you make is recoverable.
Since most of us are humans we will often make mistakes in life and when using GIT. Unlike life, GIT is a good version control system that makes it possible to recover from mistakes.
Any way here are a few useful commands to help you recover from some common mistakes
How to undo your last commit
git reset -- soft HEAD^
Un-stage staged files
This takes everything in the staging area out of the staging area
git reset HEAD
If you want to unstage a specific file you can do this
git reset HEAD filename_of_file_to_unstage.txt
Remove changes made to a modified file
This one is useful if you have made a lot of changes exited your text editor realised you should not have made those changes and CTRL-Z (undo) is no longer possible
git checkout -- filename_of_file_to_unmodify.txt
Need more help
If your mistakes go deeper than one-commit-ago, are overwritten, on deleted branches or something even more fancy and complicated (maybe due to a workflow put together by an advanced alien race) I suggest looking into the
--amend option that goes with the