blob: 9f42c0d0e63e8d23bfbf4b582a6a9a60280cca47 [file] [log] [blame]
Junio C Hamano60d00632006-04-05 10:34:431git-clean(1)
2============
3
4NAME
5----
6git-clean - Remove untracked files from the working tree
7
8SYNOPSIS
9--------
10[verse]
Junio C Hamano619596a2010-08-18 22:15:3511'git clean' [-d] [-f] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>...
Junio C Hamano60d00632006-04-05 10:34:4312
13DESCRIPTION
14-----------
Junio C Hamanoe91ea772009-04-26 01:41:4115
Junio C Hamanobde411d2009-05-07 05:07:3116Cleans the working tree by recursively removing files that are not
17under version control, starting from the current directory.
Junio C Hamanoe91ea772009-04-26 01:41:4118
19Normally, only files unknown to git are removed, but if the '-x'
20option is specified, ignored files are also removed. This can, for
21example, be useful to remove all build products.
22
Junio C Hamano9e395072008-07-31 22:11:2123If any optional `<path>...` arguments are given, only those paths
24are affected.
Junio C Hamano26a57372006-05-10 00:13:4025
Junio C Hamano60d00632006-04-05 10:34:4326OPTIONS
27-------
28-d::
29Remove untracked directories in addition to untracked files.
Junio C Hamanoac34f562009-08-16 19:04:0530If an untracked directory is managed by a different git
31repository, it is not removed by default. Use -f option twice
32if you really want to remove such a directory.
Junio C Hamano60d00632006-04-05 10:34:4333
Junio C Hamano47b9acd2007-04-24 07:34:3434-f::
Junio C Hamano68cfa3a2009-08-30 00:22:5535--force::
Junio C Hamanod3304322010-02-05 03:28:2736If the git configuration variable clean.requireForce is not set
37to false, 'git clean' will refuse to run unless given -f or -n.
Junio C Hamano47b9acd2007-04-24 07:34:3438
Junio C Hamano60d00632006-04-05 10:34:4339-n::
Junio C Hamanoeb415992008-06-08 22:49:4740--dry-run::
Junio C Hamano60d00632006-04-05 10:34:4341Don't actually remove anything, just show what would be done.
42
43-q::
Junio C Hamanoeb415992008-06-08 22:49:4744--quiet::
Junio C Hamano60d00632006-04-05 10:34:4345Be quiet, only report errors, but not the files that are
46successfully removed.
47
Junio C Hamano619596a2010-08-18 22:15:3548-e <pattern>::
49--exclude=<pattern>::
Junio C Hamano7bd050f2011-09-22 06:32:2250In addition to those found in .gitignore (per directory) and
51$GIT_DIR/info/exclude, also consider these patterns to be in the
52set of the ignore rules in effect.
Junio C Hamano619596a2010-08-18 22:15:3553
Junio C Hamano60d00632006-04-05 10:34:4354-x::
Junio C Hamano7bd050f2011-09-22 06:32:2255Don't use the standard ignore rules read from .gitignore (per
56directory) and $GIT_DIR/info/exclude, but do still use the ignore
57rules given with `-e` options. This allows removing all untracked
Junio C Hamano60d00632006-04-05 10:34:4358files, including build products. This can be used (possibly in
Junio C Hamano1aa40d22010-01-21 17:46:4359conjunction with 'git reset') to create a pristine
Junio C Hamano60d00632006-04-05 10:34:4360working directory to test a clean build.
61
62-X::
63Remove only files ignored by git. This may be useful to rebuild
64everything from scratch, but keep manually created files.
65
Junio C Hamano4f07aec2012-09-25 19:08:4466SEE ALSO
67--------
68linkgit:gitignore[5]
69
Junio C Hamano60d00632006-04-05 10:34:4370GIT
71---
Junio C Hamanof7c042d2008-06-06 22:50:5372Part of the linkgit:git[1] suite