How do you remove untracked files from your git working copy?
"git-clean" is what you are looking for. It is used to remove untracked files from the working tree:
http://www.kernel.org/pub/software/scm/git/docs/git-clean.html
git-clean - Remove untracked files from the working tree
http://www.kernel.org/pub/software/scm/git/docs/git-clean.html
git clean -f
If you just want to remove ignored files, run git clean -f -X
.
If you want to remove ignored as well as non-ignored files, run git clean -f -x
.
Note the case difference on the X
for the two latter commands.
Unless you specify -f
and clean.requireForce
is set to "true" (the default) in your configuration, nothing will actually happen, with a recent enough version of git.
Note that as of git-1.6.0, the dashed style of writing git commands (ie, git-clean
instead of git clean
) is obsoleted.
git clean -f -d to be sure that also dirs are gone! you can check with git status if they are really gone