Dogbert Dogbert - 1 month ago 8
Git Question

Reset all changes after last commit in git

How can I undo every change made to my directory after the last commit, including deleting added files, resetting modified files, and adding back deleted files?

Answer

First reset the changes

git reset HEAD --hard

then clean out everything untracked

git clean -fd