Remove untracked files from the local working tree

Sep 21, 2017 using tags git

It is sometimes useful to get rid of all the cruft you’ve built up locally without manually going in and deleting files individually. Here’s how to get that done with built-in git functions.

To list what will be deleted without actually deleting it:

$ git clean -n

To delete all your local untracked files:

$  git clean -f

To delete all untracked files & directories:

$  git clean -fd

This Stack Overflow answer was useful and provides a bit more context.