1GIT-CLEAN(1) Git Manual GIT-CLEAN(1)
2
3
4
6 git-clean - Remove untracked files from the working tree
7
9 git clean [-d] [-f] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>...
10
11
13 Cleans the working tree by recursively removing files that are not
14 under version control, starting from the current directory.
15
16 Normally, only files unknown to Git are removed, but if the -x option
17 is specified, ignored files are also removed. This can, for example, be
18 useful to remove all build products.
19
20 If any optional <path>... arguments are given, only those paths are
21 affected.
22
24 -d
25 Remove untracked directories in addition to untracked files. If an
26 untracked directory is managed by a different Git repository, it is
27 not removed by default. Use -f option twice if you really want to
28 remove such a directory.
29
30 -f, --force
31 If the Git configuration variable clean.requireForce is not set to
32 false, git clean will refuse to run unless given -f or -n.
33
34 -n, --dry-run
35 Don’t actually remove anything, just show what would be done.
36
37 -q, --quiet
38 Be quiet, only report errors, but not the files that are
39 successfully removed.
40
41 -e <pattern>, --exclude=<pattern>
42 In addition to those found in .gitignore (per directory) and
43 $GIT_DIR/info/exclude, also consider these patterns to be in the
44 set of the ignore rules in effect.
45
46 -x
47 Don’t use the standard ignore rules read from .gitignore (per
48 directory) and $GIT_DIR/info/exclude, but do still use the ignore
49 rules given with -e options. This allows removing all untracked
50 files, including build products. This can be used (possibly in
51 conjunction with git reset) to create a pristine working directory
52 to test a clean build.
53
54 -X
55 Remove only files ignored by Git. This may be useful to rebuild
56 everything from scratch, but keep manually created files.
57
59 gitignore(5)
60
62 Part of the git(1) suite
63
64
65
66Git 1.8.3.1 11/19/2018 GIT-CLEAN(1)