1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
\r
4 <sect2 lang="en" id="git-check-ignore(1)">
\r
5 <title>git-check-ignore(1)</title>
\r
7 <primary>git-check-ignore(1)</primary>
\r
9 <simplesect id="git-check-ignore(1)__name">
\r
11 <simpara>git-check-ignore - Debug gitignore / exclude files</simpara>
\r
13 <simplesect id="git-check-ignore(1)__synopsis">
\r
14 <title>SYNOPSIS</title>
\r
16 <literallayout><emphasis>git check-ignore</emphasis> [options] pathname…
\r
17 <emphasis>git check-ignore</emphasis> [options] --stdin</literallayout>
\r
20 <simplesect id="git-check-ignore(1)__description">
\r
21 <title>DESCRIPTION</title>
\r
22 <simpara>For each pathname given via the command-line or from a file via
\r
23 <emphasis>--stdin</emphasis>, check whether the file is excluded by .gitignore (or other
\r
24 input files to the exclude mechanism) and output the path if it is
\r
26 <simpara>By default, tracked files are not shown at all since they are not
\r
27 subject to exclude rules; but see --no-index.</simpara>
\r
29 <simplesect id="git-check-ignore(1)__options">
\r
30 <title>OPTIONS</title>
\r
38 Don't output anything, just set exit status. This is only
\r
39 valid with a single pathname.
\r
49 Also output details about the matching pattern (if any)
\r
50 for each given pathname. For precedence rules within and
\r
51 between exclude sources, see <xref linkend="gitignore(5)" />.
\r
61 Read pathnames from the standard input, one per line,
\r
62 instead of from the command-line.
\r
72 The output format is modified to be machine-parseable (see
\r
73 below). If <emphasis>--stdin</emphasis> is also given, input paths are separated
\r
74 with a NUL character instead of a linefeed character.
\r
84 Show given paths which don't match any pattern. This only
\r
85 makes sense when <emphasis>--verbose</emphasis> is enabled, otherwise it would
\r
86 not be possible to distinguish between paths which match a
\r
87 pattern and those which don't.
\r
97 Don't look in the index when undertaking the checks. This can
\r
98 be used to debug why a path became tracked by e.g. <emphasis>git add .</emphasis>
\r
99 and was not ignored by the rules as expected by the user or when
\r
100 developing patterns including negation to match a path previously
\r
101 added with <emphasis>git add -f</emphasis>.
\r
107 <simplesect id="git-check-ignore(1)__output">
\r
108 <title>OUTPUT</title>
\r
109 <simpara>By default, any of the given pathnames which match an ignore pattern
\r
110 will be output, one per line. If no pattern matches a given path,
\r
111 nothing will be output for that path; this means that path will not be
\r
113 <simpara>If <emphasis>--verbose</emphasis> is specified, the output is a series of lines of the form:</simpara>
\r
114 <simpara><source> <COLON> <linenum> <COLON> <pattern> <HT> <pathname></simpara>
\r
115 <simpara><pathname> is the path of a file being queried, <pattern> is the
\r
116 matching pattern, <source> is the pattern's source file, and <linenum>
\r
117 is the line number of the pattern within that source. If the pattern
\r
118 contained a <emphasis>!</emphasis> prefix or <emphasis>/</emphasis> suffix, it will be preserved in the
\r
119 output. <source> will be an absolute path when referring to the file
\r
120 configured by <emphasis>core.excludesFile</emphasis>, or relative to the repository root
\r
121 when referring to <emphasis>.git/info/exclude</emphasis> or a per-directory exclude file.</simpara>
\r
122 <simpara>If <emphasis>-z</emphasis> is specified, the pathnames in the output are delimited by the
\r
123 null character; if <emphasis>--verbose</emphasis> is also specified then null characters
\r
124 are also used instead of colons and hard tabs:</simpara>
\r
125 <simpara><source> <NULL> <linenum> <NULL> <pattern> <NULL> <pathname> <NULL></simpara>
\r
126 <simpara>If <emphasis>-n</emphasis> or <emphasis>--non-matching</emphasis> are specified, non-matching pathnames will
\r
127 also be output, in which case all fields in each output record except
\r
128 for <pathname> will be empty. This can be useful when running
\r
129 non-interactively, so that files can be incrementally streamed to
\r
130 STDIN of a long-running check-ignore process, and for each of these
\r
131 files, STDOUT will indicate whether that file matched a pattern or
\r
132 not. (Without this option, it would be impossible to tell whether the
\r
133 absence of output for a given file meant that it didn't match any
\r
134 pattern, or that the output hadn't been generated yet.)</simpara>
\r
135 <simpara>Buffering happens as documented under the <emphasis>GIT_FLUSH</emphasis> option in
\r
136 <xref linkend="git(1)" />. The caller is responsible for avoiding deadlocks
\r
137 caused by overfilling an input buffer or reading from an empty output
\r
140 <simplesect id="git-check-ignore(1)__exit_status">
\r
141 <title>EXIT STATUS</title>
\r
149 One or more of the provided paths is ignored.
\r
159 None of the provided paths are ignored.
\r
169 A fatal error was encountered.
\r
175 <simplesect id="git-check-ignore(1)__see_also">
\r
176 <title>SEE ALSO</title>
\r
177 <simpara><xref linkend="gitignore(5)" />
\r
178 <xref linkend="gitconfig(5)" />
\r
179 <xref linkend="git-ls-files(1)" /></simpara>
\r
181 <simplesect id="git-check-ignore(1)__git">
\r
183 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
\r