Remove Untracked Files With Git
When working with Git I sometimes end up with a lot of untracked local files that I want to get rid of. For example, compiling things and testing around can create more stuff than expected or a
git reset origin/master rolling back a lot of commits can leave a bunch of leftovers. To me this happens a few times a year and each time I realize that I forgot how I solved it last time. The answer is:
git clean -nDry-run, show what would be deleted
git clean -fReally delete it
git clean -dRecurse into untracked directories
For me this usually means
git clean -f -d and I am done. For more options check out the man page.