Rollback to last git commit
Caveat Emptor - Destructive commands ahead.
Mitigation - git reflog
can save you if you need it.
1) UNDO local file changes and KEEP your last commit
git reset --hard
2) UNDO local file changes and REMOVE your last commit
git reset --hard HEAD^
3) KEEP local file changes and REMOVE your last commit
git reset --soft HEAD^
If you want to remove newly added contents and files which are already staged (so added to the index) then you use:
git reset --hard
If you want to remove also your latest commit (is the one with the message "blah") then better to use:
git reset --hard HEAD^
To remove the untracked files (so new files not yet added to the index) and folders use:
git clean --force -d
git reset --hard
will force the working directory back to the last commit and delete new/changed files.