1GIT-CHECK-IGNORE(1)               Git Manual               GIT-CHECK-IGNORE(1)
2
3
4

NAME

6       git-check-ignore - Debug gitignore / exclude files
7

SYNOPSIS

9       git check-ignore [<options>] <pathname>...
10       git check-ignore [<options>] --stdin
11

DESCRIPTION

13       For each pathname given via the command-line or from a file via
14       --stdin, check whether the file is excluded by .gitignore (or other
15       input files to the exclude mechanism) and output the path if it is
16       excluded.
17
18       By default, tracked files are not shown at all since they are not
19       subject to exclude rules; but see “--no-index”.
20

OPTIONS

22       -q, --quiet
23           Don’t output anything, just set exit status. This is only valid
24           with a single pathname.
25
26       -v, --verbose
27           Instead of printing the paths that are excluded, for each path that
28           matches an exclude pattern, print the exclude pattern together with
29           the path. (Matching an exclude pattern usually means the path is
30           excluded, but if the pattern begins with !  then it is a negated
31           pattern and matching it means the path is NOT excluded.)
32
33           For precedence rules within and between exclude sources, see
34           gitignore(5).
35
36       --stdin
37           Read pathnames from the standard input, one per line, instead of
38           from the command-line.
39
40       -z
41           The output format is modified to be machine-parsable (see below).
42           If --stdin is also given, input paths are separated with a NUL
43           character instead of a linefeed character.
44
45       -n, --non-matching
46           Show given paths which don’t match any pattern. This only makes
47           sense when --verbose is enabled, otherwise it would not be possible
48           to distinguish between paths which match a pattern and those which
49           don’t.
50
51       --no-index
52           Don’t look in the index when undertaking the checks. This can be
53           used to debug why a path became tracked by e.g.  git add .  and was
54           not ignored by the rules as expected by the user or when developing
55           patterns including negation to match a path previously added with
56           git add -f.
57

OUTPUT

59       By default, any of the given pathnames which match an ignore pattern
60       will be output, one per line. If no pattern matches a given path,
61       nothing will be output for that path; this means that path will not be
62       ignored.
63
64       If --verbose is specified, the output is a series of lines of the form:
65
66       <source> <COLON> <linenum> <COLON> <pattern> <HT> <pathname>
67
68       <pathname> is the path of a file being queried, <pattern> is the
69       matching pattern, <source> is the pattern’s source file, and <linenum>
70       is the line number of the pattern within that source. If the pattern
71       contained a ! prefix or / suffix, it will be preserved in the output.
72       <source> will be an absolute path when referring to the file configured
73       by core.excludesFile, or relative to the repository root when referring
74       to .git/info/exclude or a per-directory exclude file.
75
76       If -z is specified, the pathnames in the output are delimited by the
77       null character; if --verbose is also specified then null characters are
78       also used instead of colons and hard tabs:
79
80       <source> <NULL> <linenum> <NULL> <pattern> <NULL> <pathname> <NULL>
81
82       If -n or --non-matching are specified, non-matching pathnames will also
83       be output, in which case all fields in each output record except for
84       <pathname> will be empty. This can be useful when running
85       non-interactively, so that files can be incrementally streamed to STDIN
86       of a long-running check-ignore process, and for each of these files,
87       STDOUT will indicate whether that file matched a pattern or not.
88       (Without this option, it would be impossible to tell whether the
89       absence of output for a given file meant that it didn’t match any
90       pattern, or that the output hadn’t been generated yet.)
91
92       Buffering happens as documented under the GIT_FLUSH option in git(1).
93       The caller is responsible for avoiding deadlocks caused by overfilling
94       an input buffer or reading from an empty output buffer.
95

EXIT STATUS

97       0
98           One or more of the provided paths is ignored.
99
100       1
101           None of the provided paths are ignored.
102
103       128
104           A fatal error was encountered.
105

SEE ALSO

107       gitignore(5) git-config(1) git-ls-files(1)
108

GIT

110       Part of the git(1) suite
111
112
113
114Git 2.26.2                        2020-04-20               GIT-CHECK-IGNORE(1)
Impressum