make some more strings translatable
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-grep.html.xml
blob1a7c44ed2d248ce52921720ba4738058d62f019f
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\r
3 \r
4 <article lang="en" id="git-grep(1)">\r
5 <articleinfo>\r
6     <title>git-grep(1)</title>\r
7         <indexterm>\r
8                 <primary>git-grep(1)</primary>\r
9         </indexterm>\r
10 </articleinfo>\r
11 <simplesect id="_name">\r
12 <title>NAME</title>\r
13 <simpara>git-grep - Print lines matching a pattern</simpara>\r
14 </simplesect>\r
15 <simplesect id="_synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <blockquote>\r
18 <literallayout><emphasis>git grep</emphasis> [--cached]\r
19            [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]\r
20            [-v | --invert-match] [-h|-H] [--full-name]\r
21            [-E | --extended-regexp] [-G | --basic-regexp]\r
22            [-F | --fixed-strings] [-n]\r
23            [-l | --files-with-matches] [-L | --files-without-match]\r
24            [-z | --null]\r
25            [-c | --count] [--all-match]\r
26            [-A &lt;post-context&gt;] [-B &lt;pre-context&gt;] [-C &lt;context&gt;]\r
27            [-f &lt;file&gt;] [-e] &lt;pattern&gt;\r
28            [--and|--or|--not|(|)|-e &lt;pattern&gt;&#8230;] [&lt;tree&gt;&#8230;]\r
29            [--] [&lt;path&gt;&#8230;]</literallayout>\r
30 </blockquote>\r
31 </simplesect>\r
32 <simplesect id="_description">\r
33 <title>DESCRIPTION</title>\r
34 <simpara>Look for specified patterns in the working tree files, blobs\r
35 registered in the index file, or given tree objects.</simpara>\r
36 </simplesect>\r
37 <simplesect id="_options">\r
38 <title>OPTIONS</title>\r
39 <variablelist>\r
40 <varlistentry>\r
41 <term>\r
42 --cached\r
43 </term>\r
44 <listitem>\r
45 <simpara>\r
46         Instead of searching in the working tree files, check\r
47         the blobs registered in the index file.\r
48 </simpara>\r
49 </listitem>\r
50 </varlistentry>\r
51 <varlistentry>\r
52 <term>\r
53 -a\r
54 </term>\r
55 <term>\r
56 --text\r
57 </term>\r
58 <listitem>\r
59 <simpara>\r
60         Process binary files as if they were text.\r
61 </simpara>\r
62 </listitem>\r
63 </varlistentry>\r
64 <varlistentry>\r
65 <term>\r
66 -i\r
67 </term>\r
68 <term>\r
69 --ignore-case\r
70 </term>\r
71 <listitem>\r
72 <simpara>\r
73         Ignore case differences between the patterns and the\r
74         files.\r
75 </simpara>\r
76 </listitem>\r
77 </varlistentry>\r
78 <varlistentry>\r
79 <term>\r
80 -I\r
81 </term>\r
82 <listitem>\r
83 <simpara>\r
84         Don&#8217;t match the pattern in binary files.\r
85 </simpara>\r
86 </listitem>\r
87 </varlistentry>\r
88 <varlistentry>\r
89 <term>\r
90 -w\r
91 </term>\r
92 <term>\r
93 --word-regexp\r
94 </term>\r
95 <listitem>\r
96 <simpara>\r
97         Match the pattern only at word boundary (either begin at the\r
98         beginning of a line, or preceded by a non-word character; end at\r
99         the end of a line or followed by a non-word character).\r
100 </simpara>\r
101 </listitem>\r
102 </varlistentry>\r
103 <varlistentry>\r
104 <term>\r
105 -v\r
106 </term>\r
107 <term>\r
108 --invert-match\r
109 </term>\r
110 <listitem>\r
111 <simpara>\r
112         Select non-matching lines.\r
113 </simpara>\r
114 </listitem>\r
115 </varlistentry>\r
116 <varlistentry>\r
117 <term>\r
118 -h\r
119 </term>\r
120 <term>\r
121 -H\r
122 </term>\r
123 <listitem>\r
124 <simpara>\r
125         By default, the command shows the filename for each\r
126         match.  <literal>-h</literal> option is used to suppress this output.\r
127         <literal>-H</literal> is there for completeness and does not do anything\r
128         except it overrides <literal>-h</literal> given earlier on the command\r
129         line.\r
130 </simpara>\r
131 </listitem>\r
132 </varlistentry>\r
133 <varlistentry>\r
134 <term>\r
135 --full-name\r
136 </term>\r
137 <listitem>\r
138 <simpara>\r
139         When run from a subdirectory, the command usually\r
140         outputs paths relative to the current directory.  This\r
141         option forces paths to be output relative to the project\r
142         top directory.\r
143 </simpara>\r
144 </listitem>\r
145 </varlistentry>\r
146 <varlistentry>\r
147 <term>\r
148 -E\r
149 </term>\r
150 <term>\r
151 --extended-regexp\r
152 </term>\r
153 <term>\r
154 -G\r
155 </term>\r
156 <term>\r
157 --basic-regexp\r
158 </term>\r
159 <listitem>\r
160 <simpara>\r
161         Use POSIX extended/basic regexp for patterns.  Default\r
162         is to use basic regexp.\r
163 </simpara>\r
164 </listitem>\r
165 </varlistentry>\r
166 <varlistentry>\r
167 <term>\r
168 -F\r
169 </term>\r
170 <term>\r
171 --fixed-strings\r
172 </term>\r
173 <listitem>\r
174 <simpara>\r
175         Use fixed strings for patterns (don&#8217;t interpret pattern\r
176         as a regex).\r
177 </simpara>\r
178 </listitem>\r
179 </varlistentry>\r
180 <varlistentry>\r
181 <term>\r
182 -n\r
183 </term>\r
184 <listitem>\r
185 <simpara>\r
186         Prefix the line number to matching lines.\r
187 </simpara>\r
188 </listitem>\r
189 </varlistentry>\r
190 <varlistentry>\r
191 <term>\r
192 -l\r
193 </term>\r
194 <term>\r
195 --files-with-matches\r
196 </term>\r
197 <term>\r
198 --name-only\r
199 </term>\r
200 <term>\r
201 -L\r
202 </term>\r
203 <term>\r
204 --files-without-match\r
205 </term>\r
206 <listitem>\r
207 <simpara>\r
208         Instead of showing every matched line, show only the\r
209         names of files that contain (or do not contain) matches.\r
210         For better compatibility with <emphasis>git-diff</emphasis>, --name-only is a\r
211         synonym for --files-with-matches.\r
212 </simpara>\r
213 </listitem>\r
214 </varlistentry>\r
215 <varlistentry>\r
216 <term>\r
217 -z\r
218 </term>\r
219 <term>\r
220 --null\r
221 </term>\r
222 <listitem>\r
223 <simpara>\r
224         Output \0 instead of the character that normally follows a\r
225         file name.\r
226 </simpara>\r
227 </listitem>\r
228 </varlistentry>\r
229 <varlistentry>\r
230 <term>\r
231 -c\r
232 </term>\r
233 <term>\r
234 --count\r
235 </term>\r
236 <listitem>\r
237 <simpara>\r
238         Instead of showing every matched line, show the number of\r
239         lines that match.\r
240 </simpara>\r
241 </listitem>\r
242 </varlistentry>\r
243 <varlistentry>\r
244 <term>\r
245 -[ABC] &lt;context&gt;\r
246 </term>\r
247 <listitem>\r
248 <simpara>\r
249         Show <literal>context</literal> trailing (<literal>A</literal>&#8201;&#8212;&#8201;after), or leading (<literal>B</literal>\r
250        &#8201;&#8212;&#8201;before), or both (<literal>C</literal>&#8201;&#8212;&#8201;context) lines, and place a\r
251         line containing <literal>--</literal> between contiguous groups of\r
252         matches.\r
253 </simpara>\r
254 </listitem>\r
255 </varlistentry>\r
256 <varlistentry>\r
257 <term>\r
258 -&lt;num&gt;\r
259 </term>\r
260 <listitem>\r
261 <simpara>\r
262         A shortcut for specifying -C&lt;num&gt;.\r
263 </simpara>\r
264 </listitem>\r
265 </varlistentry>\r
266 <varlistentry>\r
267 <term>\r
268 -f &lt;file&gt;\r
269 </term>\r
270 <listitem>\r
271 <simpara>\r
272         Read patterns from &lt;file&gt;, one per line.\r
273 </simpara>\r
274 </listitem>\r
275 </varlistentry>\r
276 <varlistentry>\r
277 <term>\r
278 -e\r
279 </term>\r
280 <listitem>\r
281 <simpara>\r
282         The next parameter is the pattern. This option has to be\r
283         used for patterns starting with - and should be used in\r
284         scripts passing user input to grep.  Multiple patterns are\r
285         combined by <emphasis>or</emphasis>.\r
286 </simpara>\r
287 </listitem>\r
288 </varlistentry>\r
289 <varlistentry>\r
290 <term>\r
291 --and\r
292 </term>\r
293 <term>\r
294 --or\r
295 </term>\r
296 <term>\r
297 --not\r
298 </term>\r
299 <term>\r
300 ( &#8230; )\r
301 </term>\r
302 <listitem>\r
303 <simpara>\r
304         Specify how multiple patterns are combined using Boolean\r
305         expressions.  <literal>--or</literal> is the default operator.  <literal>--and</literal> has\r
306         higher precedence than <literal>--or</literal>.  <literal>-e</literal> has to be used for all\r
307         patterns.\r
308 </simpara>\r
309 </listitem>\r
310 </varlistentry>\r
311 <varlistentry>\r
312 <term>\r
313 --all-match\r
314 </term>\r
315 <listitem>\r
316 <simpara>\r
317         When giving multiple pattern expressions combined with <literal>--or</literal>,\r
318         this flag is specified to limit the match to files that\r
319         have lines to match all of them.\r
320 </simpara>\r
321 </listitem>\r
322 </varlistentry>\r
323 <varlistentry>\r
324 <term>\r
325 <literal>&lt;tree&gt;&#8230;</literal>\r
326 </term>\r
327 <listitem>\r
328 <simpara>\r
329         Search blobs in the trees for specified patterns.\r
330 </simpara>\r
331 </listitem>\r
332 </varlistentry>\r
333 <varlistentry>\r
334 <term>\r
335 --\r
336 </term>\r
337 <listitem>\r
338 <simpara>\r
339         Signals the end of options; the rest of the parameters\r
340         are &lt;path&gt; limiters.\r
341 </simpara>\r
342 </listitem>\r
343 </varlistentry>\r
344 </variablelist>\r
345 </simplesect>\r
346 <simplesect id="_example">\r
347 <title>Example</title>\r
348 <variablelist>\r
349 <varlistentry>\r
350 <term>\r
351 git grep -e '#define\' --and \( -e MAX_PATH -e PATH_MAX \)\r
352 </term>\r
353 <listitem>\r
354 <simpara>\r
355         Looks for a line that has <literal>#define</literal> and either <literal>MAX_PATH</literal> or\r
356         <literal>PATH_MAX</literal>.\r
357 </simpara>\r
358 </listitem>\r
359 </varlistentry>\r
360 <varlistentry>\r
361 <term>\r
362 git grep --all-match -e NODE -e Unexpected\r
363 </term>\r
364 <listitem>\r
365 <simpara>\r
366         Looks for a line that has <literal>NODE</literal> or <literal>Unexpected</literal> in\r
367         files that have lines that match both.\r
368 </simpara>\r
369 </listitem>\r
370 </varlistentry>\r
371 </variablelist>\r
372 </simplesect>\r
373 <simplesect id="_author">\r
374 <title>Author</title>\r
375 <simpara>Originally written by Linus Torvalds &lt;<ulink url="mailto:torvalds@osdl.org">torvalds@osdl.org</ulink>&gt;, later\r
376 revamped by Junio C Hamano.</simpara>\r
377 </simplesect>\r
378 <simplesect id="_documentation">\r
379 <title>Documentation</title>\r
380 <simpara>Documentation by Junio C Hamano and the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>\r
381 </simplesect>\r
382 <simplesect id="_git">\r
383 <title>GIT</title>\r
384 <simpara>Part of the <xref linkend="git(1)"/> suite</simpara>\r
385 </simplesect>\r
386 </article>\r