git clean Delete untracked files from the working folder

Removes files Git does not track, such as build output or stray new files. It is permanent, so do a dry run first.

Synopsis

git clean [OPTION]... [PATH]...

Common options

Option or formWhat it does
-n, --dry-runShow what would be deleted without deleting
-f, --forceActually delete. Required by default
-dInclude untracked folders
-xAlso remove files ignored by .gitignore
-iChoose interactively

Examples

Preview what would go
git clean -n
Would remove notes.txt
Delete untracked files
git clean -f
Delete untracked files and folders
git clean -fd
Wipe build output too
git clean -fdx
Pick from a list
git clean -i

Notes

See also

Last reviewed 2026-10-09.