How do I delete untracked local files from the current working tree?
Git – How to Remove Local Untracked Files from Current Git Working Tree
branchgitgit-branch
branchgitgit-branch
How do I delete untracked local files from the current working tree?
Best Answer
Step 1 is to show what will be deleted by using the
-n
option:Clean Step - beware: this will delete files:
git clean -f -d
orgit clean -fd
git clean -f -X
orgit clean -fX
git clean -f -x
orgit clean -fx
Note the case difference on the
X
for the two latter commands.If
clean.requireForce
is set to "true" (the default) in your configuration, one needs to specify-f
otherwise nothing will actually happen.Again see the
git-clean
docs for more information.