Note: These commands can easily cause data loss. Please do not run them if you do not understand what they do. Even if you do understand, make a backup just in case.

If you need to wipe out all of your local changes:

Use git reset to revert any local changes

$ git reset --hard HEAD

Change HEAD to a branch name, tag, or commit hash to revert further back in history.

Delete any untracked or ignored files:

git clean -fdx

Remove the -x if you only wish to delete untracked files, but want to leave ignored files. Replace -f with -n to do a dry-run.

After running these two commands, you should be left with a directory which has no local changes.