I'm using Git for version control. Now I want to delete on my local machine all files in the repository that are not tracked.

I can use

git status

to list these files, but how can I delete all of them?

link|improve this question

56% accept rate
1  
Cant you just check out all the files to a different place one your machine and then delete the old version? – Nifle Sep 14 '11 at 13:59
For sure I can, but isn't there a simpler way? – Roflcoptr Sep 14 '11 at 14:01
feedback

2 Answers

up vote 6 down vote accepted

If you have it in ignore, use git clean -xf. You can do git clean -df but that will also remove un-tracked directories. Use -n for a dry-run.

See cleaning up un-tracked

link|improve this answer
feedback
git clean -f
link|improve this answer
It might make sense to add the meaning of that command to make this answer self-contained. – N.N. Sep 14 '11 at 18:47
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.