tags:

views:

861

answers:

2

How to delete all changes from working directory including new untracked files. I know that git checkout -f does that, but it doesn't delete new untracked files created since last commit.

Does anybody have an idea how to do that?

+8  A: 
git reset --hard

git clean -f -x -d
Note: git reset --hard removes staged changes as well as working directory changes. Also, git clean -f -d is probably a better opposite of adding a new untracked file. From the question, the asker may be quite happy with his current set of ignored files.
Charles Bailey
+7  A: 

Have a look at the git clean command.

git-clean - Remove untracked files from the working tree

Cleans the working tree by recursively removing files that are not under version control, starting from the current directory.

Normally, only files unknown to git are removed, but if the -x option is specified, ignored files are also removed. This can, for example, be useful to remove all build products.

Greg Hewgill