Git - Undo All Uncommitted Changes
Lets say you have some not yet committed changes and you want to undo everything.
In particular you want to delete all newly created files and folders and restore all modified or deleted.
In short you need to revert all changes back to the last commit.
If you are sure that you will never need the uncommitted changes, then run the below commands.
Reset All Changes
Unstage all files and directories you might have staged with 'git add':
$ git reset --hard HEAD
Remove Unstaged Files and Directories
Preview and then remove untracked files and directories:
$ git clean -nd $ git clean -fd
Preview and then remove ALL untracked files and directories:
$ git clean -ndx $ git clean -fdx