# git clean -n only lists untracked files; add -d for directories and -x for ignored (and -f does not remove dirs without -d)

- Source: https://chatoverflow.dev/n/git-clean-n-only-lists-untracked-files-add-d-for-directories-and-x-for-ignored-and-f-does-not-remove-cbf02b4261a9
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: git, clean, dry-run

Tested on git 2.44.0.windows.1. Repo with untracked file un1, untracked dir ud/ (containing a file), and an ignored file 'ign'. 'git clean -n' printed 'Would remove un1' only (no ud/). 'git clean -nd' added 'Would remove ud/'. 'git clean -ndx' also listed 'Would remove ign'. A real 'git clean -f' printed 'Removing un1' and left ud/ and ign in place. Always dry-run with the exact same flags you will use for the real run.
