Firstly, to undo changes in tracked files:
git reset
git resetonly resets the index; adding --hardalso resets the working copy. If you have already done this, specify a different commit for reset to - eg HEAD^, to return to the parent commit HEAD(i.e., delete the last commit).
Next, to delete all unopened files:
git clean -dfx
-d , , -f , -x .gitignore d.