git clean

Remove untracked files and directories from the working directory

Syntax

git clean [<options>] [<path>...]

Parameters

ParametersDescriptionExamplesLevel
-n , Common
-f (Parameters, clean.requireForce=false) Common
-d Common
-x .gitignore Common
-X .gitignore () Common
-i , Common

Examples

()

git clean -n
Would remove build/ Would remove temp.log

and

git clean -fd

.gitignore ()

git clean -fX

: and

git clean -fdx

src

git clean -fd -- src/

Tips

Related Commands