git clean

Updated: 10 January 2025

Remove un-tracked directories and files from the working tree

git clean -fd

Remove un-tracked directories and files from the working tree. Also remove (-X) ignored files.
Can be combined with the -n/--dry-run option

git clean -fdX

Leave a comment