Git – How to Delete All Untracked Files

git

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?

Best Answer

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

Related Question