git clean

Remove untracked files

high risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
Safer / dry-run alternatives
git clean -ndDry run
git stash push -uKeep a copy
What it does

Removes files not tracked by git. See the flags and examples below, and run `man git` for the full reference.

Common flags
FlagMeaning
-nDry run
-fForce (required)⚠ Deletes files.
-dInclude directories
-xInclude ignored files⚠ Deletes .env, build output, local config.
Examples
git clean -ndDry run · explain & risk-check →
git clean -fdDelete untracked files and dirs · explain & risk-check →
Related
git status
Open the full explainer →More in Git

Reference text is hand-written and may be incomplete — check man git for your version. Test destructive commands on a non-production system first.