git clean
Remove untracked files and directories from the working directory
Syntax
git clean [<options>] [<path>...]
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
-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
- -n,
- -X(),
- git clean -fdx Common CI
- git checkout --.