1GIT-CHECK-IGNORE(1) Git Manual GIT-CHECK-IGNORE(1)
2
3
4
6 git-check-ignore - Debug gitignore / exclude files
7
9 git check-ignore [<options>] <pathname>...
10 git check-ignore [<options>] --stdin
11
12
14 For each pathname given via the command-line or from a file via
15 --stdin, check whether the file is excluded by .gitignore (or other
16 input files to the exclude mechanism) and output the path if it is
17 excluded.
18
19 By default, tracked files are not shown at all since they are not
20 subject to exclude rules; but see ‘--no-index’.
21
23 -q, --quiet
24 Don’t output anything, just set exit status. This is only valid
25 with a single pathname.
26
27 -v, --verbose
28 Also output details about the matching pattern (if any) for each
29 given pathname. For precedence rules within and between exclude
30 sources, see gitignore(5).
31
32 --stdin
33 Read pathnames from the standard input, one per line, instead of
34 from the command-line.
35
36 -z
37 The output format is modified to be machine-parseable (see below).
38 If --stdin is also given, input paths are separated with a NUL
39 character instead of a linefeed character.
40
41 -n, --non-matching
42 Show given paths which don’t match any pattern. This only makes
43 sense when --verbose is enabled, otherwise it would not be possible
44 to distinguish between paths which match a pattern and those which
45 don’t.
46
47 --no-index
48 Don’t look in the index when undertaking the checks. This can be
49 used to debug why a path became tracked by e.g. git add . and was
50 not ignored by the rules as expected by the user or when developing
51 patterns including negation to match a path previously added with
52 git add -f.
53
55 By default, any of the given pathnames which match an ignore pattern
56 will be output, one per line. If no pattern matches a given path,
57 nothing will be output for that path; this means that path will not be
58 ignored.
59
60 If --verbose is specified, the output is a series of lines of the form:
61
62 <source> <COLON> <linenum> <COLON> <pattern> <HT> <pathname>
63
64 <pathname> is the path of a file being queried, <pattern> is the
65 matching pattern, <source> is the pattern’s source file, and <linenum>
66 is the line number of the pattern within that source. If the pattern
67 contained a ! prefix or / suffix, it will be preserved in the output.
68 <source> will be an absolute path when referring to the file configured
69 by core.excludesFile, or relative to the repository root when referring
70 to .git/info/exclude or a per-directory exclude file.
71
72 If -z is specified, the pathnames in the output are delimited by the
73 null character; if --verbose is also specified then null characters are
74 also used instead of colons and hard tabs:
75
76 <source> <NULL> <linenum> <NULL> <pattern> <NULL> <pathname> <NULL>
77
78 If -n or --non-matching are specified, non-matching pathnames will also
79 be output, in which case all fields in each output record except for
80 <pathname> will be empty. This can be useful when running
81 non-interactively, so that files can be incrementally streamed to STDIN
82 of a long-running check-ignore process, and for each of these files,
83 STDOUT will indicate whether that file matched a pattern or not.
84 (Without this option, it would be impossible to tell whether the
85 absence of output for a given file meant that it didn’t match any
86 pattern, or that the output hadn’t been generated yet.)
87
88 Buffering happens as documented under the GIT_FLUSH option in git(1).
89 The caller is responsible for avoiding deadlocks caused by overfilling
90 an input buffer or reading from an empty output buffer.
91
93 0
94 One or more of the provided paths is ignored.
95
96 1
97 None of the provided paths are ignored.
98
99 128
100 A fatal error was encountered.
101
103 gitignore(5) git-config(1) git-ls-files(1)
104
106 Part of the git(1) suite
107
108
109
110Git 2.18.1 05/14/2019 GIT-CHECK-IGNORE(1)