Update git documentation
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-check-ignore.xml
blob0c6340f36dbca83fe89f6c3b2e7e4d940002b39d
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
3 \r
4 <sect2 lang="en" id="git-check-ignore(1)">\r
5     <title>git-check-ignore(1)</title>\r
6 <indexterm>\r
7 <primary>git-check-ignore(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="git-check-ignore(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>git-check-ignore - Debug gitignore / exclude files</simpara>\r
12 </simplesect>\r
13 <simplesect id="git-check-ignore(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <blockquote>\r
16 <literallayout><emphasis>git check-ignore</emphasis> [options] pathname&#8230;\r
17 <emphasis>git check-ignore</emphasis> [options] --stdin</literallayout>\r
18 </blockquote>\r
19 </simplesect>\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
25 excluded.</simpara>\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
28 </simplesect>\r
29 <simplesect id="git-check-ignore(1)__options">\r
30 <title>OPTIONS</title>\r
31 <variablelist>\r
32 <varlistentry>\r
33 <term>\r
34 -q, --quiet\r
35 </term>\r
36 <listitem>\r
37 <simpara>\r
38         Don't output anything, just set exit status.  This is only\r
39         valid with a single pathname.\r
40 </simpara>\r
41 </listitem>\r
42 </varlistentry>\r
43 <varlistentry>\r
44 <term>\r
45 -v, --verbose\r
46 </term>\r
47 <listitem>\r
48 <simpara>\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
52 </simpara>\r
53 </listitem>\r
54 </varlistentry>\r
55 <varlistentry>\r
56 <term>\r
57 --stdin\r
58 </term>\r
59 <listitem>\r
60 <simpara>\r
61         Read pathnames from the standard input, one per line,\r
62         instead of from the command-line.\r
63 </simpara>\r
64 </listitem>\r
65 </varlistentry>\r
66 <varlistentry>\r
67 <term>\r
68 -z\r
69 </term>\r
70 <listitem>\r
71 <simpara>\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
75 </simpara>\r
76 </listitem>\r
77 </varlistentry>\r
78 <varlistentry>\r
79 <term>\r
80 -n, --non-matching\r
81 </term>\r
82 <listitem>\r
83 <simpara>\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
88 </simpara>\r
89 </listitem>\r
90 </varlistentry>\r
91 <varlistentry>\r
92 <term>\r
93 --no-index\r
94 </term>\r
95 <listitem>\r
96 <simpara>\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
102 </simpara>\r
103 </listitem>\r
104 </varlistentry>\r
105 </variablelist>\r
106 </simplesect>\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
112 ignored.</simpara>\r
113 <simpara>If <emphasis>--verbose</emphasis> is specified, the output is a series of lines of the form:</simpara>\r
114 <simpara>&lt;source&gt; &lt;COLON&gt; &lt;linenum&gt; &lt;COLON&gt; &lt;pattern&gt; &lt;HT&gt; &lt;pathname&gt;</simpara>\r
115 <simpara>&lt;pathname&gt; is the path of a file being queried, &lt;pattern&gt; is the\r
116 matching pattern, &lt;source&gt; is the pattern's source file, and &lt;linenum&gt;\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.  &lt;source&gt; 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>&lt;source&gt; &lt;NULL&gt; &lt;linenum&gt; &lt;NULL&gt; &lt;pattern&gt; &lt;NULL&gt; &lt;pathname&gt; &lt;NULL&gt;</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 &lt;pathname&gt; 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
138 buffer.</simpara>\r
139 </simplesect>\r
140 <simplesect id="git-check-ignore(1)__exit_status">\r
141 <title>EXIT STATUS</title>\r
142 <variablelist>\r
143 <varlistentry>\r
144 <term>\r
146 </term>\r
147 <listitem>\r
148 <simpara>\r
149         One or more of the provided paths is ignored.\r
150 </simpara>\r
151 </listitem>\r
152 </varlistentry>\r
153 <varlistentry>\r
154 <term>\r
156 </term>\r
157 <listitem>\r
158 <simpara>\r
159         None of the provided paths are ignored.\r
160 </simpara>\r
161 </listitem>\r
162 </varlistentry>\r
163 <varlistentry>\r
164 <term>\r
165 128\r
166 </term>\r
167 <listitem>\r
168 <simpara>\r
169         A fatal error was encountered.\r
170 </simpara>\r
171 </listitem>\r
172 </varlistentry>\r
173 </variablelist>\r
174 </simplesect>\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
180 </simplesect>\r
181 <simplesect id="git-check-ignore(1)__git">\r
182 <title>GIT</title>\r
183 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
184 </simplesect>\r
185 </sect2>\r