git clean -fdX

Category: Git - Core

git clean -fdX

Remove only ignored files and directories

Deletes ignored files and directories from the working tree: -f forces, -d includes directories, and -X targets only ignored paths. Use it to purge build artifacts while keeping your own files. Run git clean -n first to preview exactly what would be removed.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.