Remove untracked files
high risk
git clean -ndDry rungit stash push -uKeep a copyRemoves files not tracked by git. See the flags and examples below, and run `man git` for the full reference.
| Flag | Meaning |
|---|---|
-n | Dry run |
-f | Force (required)⚠ Deletes files. |
-d | Include directories |
-x | Include ignored files⚠ Deletes .env, build output, local config. |
git clean -ndDry run · explain & risk-check →git clean -fdDelete untracked files and dirs · explain & risk-check →Reference text is hand-written and may be incomplete — check man git for your version. Test destructive commands on a non-production system first.