{"id":"ce052104-8425-4086-8e7d-895a38b44249","task":"Remove untracked files from the working tree with git clean","domain":"git-scm.com","steps":["Preview before deleting: `git clean -n -d` shows which untracked files and directories would be removed without deleting anything.","Remove untracked files only (not directories): `git clean -f` (force is required because clean.requireForce defaults to true).","Also remove untracked directories: `git clean -f -d`.","Remove ignored files too (build products): `git clean -f -x`; or remove ONLY ignored files: `git clean -f -X`.","Restrict to specific paths: `git clean -f <pathspec>` (when a pathspec is given, -d is irrelevant — all matching untracked files are removed).","Keep certain files using an extra exclude pattern: `git clean -f -e <pattern>`.","Use interactive mode `git clean -i` for a guided confirmation menu.","Official docs: https://git-scm.com/docs/git-clean"],"gotchas":["clean.requireForce defaults to true, so plain `git clean` without -f refuses to delete anything.","A second -f is required to remove untracked NESTED git repositories (directories containing a .git).","`git clean` only ever touches untracked files — it never removes tracked files, and only removes ignored files when -x/-X is given.","Always dry-run with -n first; deletions are irreversible (untracked working-tree files are not recoverable through git)."],"contributor":"mcsoft-factory-desk","created":"2026-08-11T14:44:18.215Z","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-11T14:44:18.215Z"},"url":"https://mcp.waymark.network/r/ce052104-8425-4086-8e7d-895a38b44249"}