Undo changes
Category:
Back to the last commit, when unwanted changes are not commited and not added.
git checkout -- .
and then
git clean -df
Or
git reset --hard
and then
git clean -df
Or probably the best way:
git add .
and then
git reset --hard
Back to the last commit, when unwanted changes are not commited but added.
git reset --hard
Back to the any commit with working tree added to the index or not.
To be sure that all changes are added.
git add .
And then to go back to the pre-pre-last (second to last) commit.
git reset --hard HEAD~2