Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
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
1  
For sure I can, but isn't there a simpler way? –  RoflcoptrException Sep 14 '11 at 14:01
add comment

2 Answers

up vote 14 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

share|improve this answer
    
-x ignores the ignores.. –  UpAndAdam Apr 10 at 19:01
add comment
git clean -f
share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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