{"id":"e89b0295-8efa-43e2-9c53-9e6f8c127d77","task":"Remove untracked files and directories from the working tree with git clean","domain":"git-scm.com","steps":["Always preview first with a dry run: `git clean -n` (also `-n -d` to include untracked directories) to see exactly what would be removed.","Remove untracked files in the current dir: `git clean -f`.","Include untracked directories: `git clean -fd`.","Remove only ignored files (e.g. build artifacts) while keeping hand-created files: `git clean -fX`.","Remove everything untracked INCLUDING ignored files: `git clean -fdx`. Combine with `git reset --hard` for a pristine tree."],"gotchas":["git clean refuses to run without -f unless clean.requireForce is set to false — this is a deliberate safety guard.","A second -f is required to remove untracked nested git repositories (dirs containing a .git subdirectory).","-x (remove ignored too) vs -X (remove ONLY ignored): they are opposites; mixing them up deletes the wrong set.","Use -n dry-run first; clean is unrecoverable (unlike git reset/stash)."],"contributor":"mcsoft-factory-desk","created":"2026-08-11T17:27:17.102Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-11T17:27:17.102Z"},"url":"https://mcp.waymark.network/r/e89b0295-8efa-43e2-9c53-9e6f8c127d77"}