blob: 0fc0117eb342ec92a1123dcdfcfe730f0cc3b65d [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
Junio C Hamano1a4e8412005-12-27 08:17:237<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamano1a4e8412005-12-27 08:17:2326
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
45}
46
Junio C Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2348 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamano1a4e8412005-12-27 08:17:2359
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2384}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamano1a4e8412005-12-27 08:17:23155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamano1a4e8412005-12-27 08:17:23166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamano1a4e8412005-12-27 08:17:23171
172div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamano1a4e8412005-12-27 08:17:23215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamano1a4e8412005-12-27 08:17:23236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamano1a4e8412005-12-27 08:17:23275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23306</style>
307<title>git-grep(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-grep(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-grep -
Junio C Hamano01078922006-03-10 00:31:47317 Print lines matching a pattern
Junio C Hamano1a4e8412005-12-27 08:17:23318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamano617fdb82006-05-16 02:14:21323<div class="verseblock">
Junio C Hamanofce7c7e2008-07-02 03:06:38324<div class="content"><em>git grep</em> [--cached]
Junio C Hamano617fdb82006-05-16 02:14:21325 [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
Junio C Hamano97efb002006-09-16 18:16:04326 [-v | --invert-match] [-h|-H] [--full-name]
Junio C Hamano9882a522007-04-27 08:22:22327 [-E | --extended-regexp] [-G | --basic-regexp]
328 [-F | --fixed-strings] [-n]
329 [-l | --files-with-matches] [-L | --files-without-match]
Junio C Hamanofbe00522006-10-19 05:58:48330 [-c | --count] [--all-match]
Junio C Hamano617fdb82006-05-16 02:14:21331 [-A &lt;post-context&gt;] [-B &lt;pre-context&gt;] [-C &lt;context&gt;]
Junio C Hamano9882a522007-04-27 08:22:22332 [-f &lt;file&gt;] [-e] &lt;pattern&gt;
333 [--and|--or|--not|(|)|-e &lt;pattern&gt;&#8230;] [&lt;tree&gt;&#8230;]
Junio C Hamano617fdb82006-05-16 02:14:21334 [--] [&lt;path&gt;&#8230;]</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23335</div>
Junio C Hamanoba4b9282008-07-06 05:20:31336<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23337<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31338<div class="para"><p>Look for specified patterns in the working tree files, blobs
339registered in the index file, or given tree objects.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23340</div>
Junio C Hamanoba4b9282008-07-06 05:20:31341<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23342<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31343<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:23344<dt>
Junio C Hamano617fdb82006-05-16 02:14:21345--cached
346</dt>
347<dd>
348<p>
349 Instead of searching in the working tree files, check
Junio C Hamano341071d2006-06-04 07:24:48350 the blobs registered in the index file.
Junio C Hamano617fdb82006-05-16 02:14:21351</p>
352</dd>
353<dt>
Junio C Hamanoeb415992008-06-08 22:49:47354-a
355</dt>
356<dt>
357--text
Junio C Hamano617fdb82006-05-16 02:14:21358</dt>
359<dd>
360<p>
361 Process binary files as if they were text.
362</p>
363</dd>
364<dt>
Junio C Hamanoeb415992008-06-08 22:49:47365-i
366</dt>
367<dt>
368--ignore-case
Junio C Hamano617fdb82006-05-16 02:14:21369</dt>
370<dd>
371<p>
372 Ignore case differences between the patterns and the
373 files.
374</p>
375</dd>
376<dt>
Junio C Hamano9882a522007-04-27 08:22:22377-I
378</dt>
379<dd>
380<p>
381 Don't match the pattern in binary files.
382</p>
383</dd>
384<dt>
Junio C Hamanoeb415992008-06-08 22:49:47385-w
386</dt>
387<dt>
388--word-regexp
Junio C Hamano617fdb82006-05-16 02:14:21389</dt>
390<dd>
391<p>
392 Match the pattern only at word boundary (either begin at the
393 beginning of a line, or preceded by a non-word character; end at
394 the end of a line or followed by a non-word character).
395</p>
396</dd>
397<dt>
Junio C Hamanoeb415992008-06-08 22:49:47398-v
399</dt>
400<dt>
401--invert-match
Junio C Hamano617fdb82006-05-16 02:14:21402</dt>
403<dd>
404<p>
405 Select non-matching lines.
406</p>
407</dd>
408<dt>
Junio C Hamanoeb415992008-06-08 22:49:47409-h
410</dt>
411<dt>
412-H
Junio C Hamano97efb002006-09-16 18:16:04413</dt>
414<dd>
415<p>
416 By default, the command shows the filename for each
417 match. <tt>-h</tt> option is used to suppress this output.
418 <tt>-H</tt> is there for completeness and does not do anything
419 except it overrides <tt>-h</tt> given earlier on the command
420 line.
421</p>
422</dd>
423<dt>
Junio C Hamano85e45fa2006-08-13 07:47:41424--full-name
425</dt>
426<dd>
427<p>
428 When run from a subdirectory, the command usually
429 outputs paths relative to the current directory. This
430 option forces paths to be output relative to the project
431 top directory.
432</p>
433</dd>
434<dt>
Junio C Hamanoeb415992008-06-08 22:49:47435-E
436</dt>
437<dt>
438--extended-regexp
439</dt>
440<dt>
441-G
442</dt>
443<dt>
444--basic-regexp
Junio C Hamano617fdb82006-05-16 02:14:21445</dt>
446<dd>
447<p>
448 Use POSIX extended/basic regexp for patterns. Default
449 is to use basic regexp.
450</p>
451</dd>
452<dt>
Junio C Hamanoeb415992008-06-08 22:49:47453-F
454</dt>
455<dt>
456--fixed-strings
Junio C Hamano9882a522007-04-27 08:22:22457</dt>
458<dd>
459<p>
460 Use fixed strings for patterns (don't interpret pattern
461 as a regex).
462</p>
463</dd>
464<dt>
Junio C Hamano617fdb82006-05-16 02:14:21465-n
466</dt>
467<dd>
468<p>
469 Prefix the line number to matching lines.
470</p>
471</dd>
472<dt>
Junio C Hamanoeb415992008-06-08 22:49:47473-l
474</dt>
475<dt>
476--files-with-matches
477</dt>
478<dt>
479--name-only
480</dt>
481<dt>
482-L
483</dt>
484<dt>
485--files-without-match
Junio C Hamano617fdb82006-05-16 02:14:21486</dt>
487<dd>
488<p>
489 Instead of showing every matched line, show only the
490 names of files that contain (or do not contain) matches.
Junio C Hamanoba4b9282008-07-06 05:20:31491 For better compatibility with <em>git-diff</em>, --name-only is a
Junio C Hamano074766f2008-02-22 22:57:06492 synonym for --files-with-matches.
Junio C Hamano617fdb82006-05-16 02:14:21493</p>
494</dd>
495<dt>
Junio C Hamanoeb415992008-06-08 22:49:47496-c
497</dt>
498<dt>
499--count
Junio C Hamano617fdb82006-05-16 02:14:21500</dt>
501<dd>
502<p>
503 Instead of showing every matched line, show the number of
504 lines that match.
505</p>
506</dd>
507<dt>
508-[ABC] &lt;context&gt;
509</dt>
510<dd>
511<p>
512 Show <tt>context</tt> trailing (<tt>A</tt> &#8212; after), or leading (<tt>B</tt>
513 &#8212; before), or both (<tt>C</tt> &#8212; context) lines, and place a
Junio C Hamano341071d2006-06-04 07:24:48514 line containing <tt>--</tt> between contiguous groups of
Junio C Hamano617fdb82006-05-16 02:14:21515 matches.
516</p>
517</dd>
518<dt>
Junio C Hamano9882a522007-04-27 08:22:22519-&lt;num&gt;
520</dt>
521<dd>
522<p>
523 A shortcut for specifying -C&lt;num&gt;.
524</p>
525</dd>
526<dt>
Junio C Hamano617fdb82006-05-16 02:14:21527-f &lt;file&gt;
528</dt>
529<dd>
530<p>
531 Read patterns from &lt;file&gt;, one per line.
532</p>
533</dd>
534<dt>
Junio C Hamano3901ffb2006-06-26 23:46:53535-e
536</dt>
537<dd>
538<p>
539 The next parameter is the pattern. This option has to be
540 used for patterns starting with - and should be used in
Junio C Hamano00442022006-08-03 00:29:36541 scripts passing user input to grep. Multiple patterns are
542 combined by <em>or</em>.
543</p>
544</dd>
545<dt>
Junio C Hamanoeb415992008-06-08 22:49:47546--and
547</dt>
548<dt>
549--or
550</dt>
551<dt>
552--not
553</dt>
554<dt>
555( &#8230; )
Junio C Hamano00442022006-08-03 00:29:36556</dt>
557<dd>
558<p>
Junio C Hamanof9771f62007-01-17 17:42:30559 Specify how multiple patterns are combined using Boolean
Junio C Hamano00442022006-08-03 00:29:36560 expressions. <tt>--or</tt> is the default operator. <tt>--and</tt> has
561 higher precedence than <tt>--or</tt>. <tt>-e</tt> has to be used for all
562 patterns.
Junio C Hamano3901ffb2006-06-26 23:46:53563</p>
564</dd>
565<dt>
Junio C Hamanofbe00522006-10-19 05:58:48566--all-match
567</dt>
568<dd>
569<p>
570 When giving multiple pattern expressions combined with <tt>--or</tt>,
571 this flag is specified to limit the match to files that
572 have lines to match all of them.
573</p>
574</dd>
575<dt>
Junio C Hamano617fdb82006-05-16 02:14:21576<tt>&lt;tree&gt;&#8230;</tt>
577</dt>
578<dd>
579<p>
580 Search blobs in the trees for specified patterns.
581</p>
582</dd>
583<dt>
Junio C Hamano00442022006-08-03 00:29:36584--
Junio C Hamanoa6331a82006-01-22 07:50:33585</dt>
586<dd>
587<p>
588 Signals the end of options; the rest of the parameters
589 are &lt;path&gt; limiters.
590</p>
591</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31592</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:23593</div>
Junio C Hamanoba4b9282008-07-06 05:20:31594<h2 id="_example">Example</h2>
Junio C Hamano00442022006-08-03 00:29:36595<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31596<div class="vlist"><dl>
Junio C Hamano00442022006-08-03 00:29:36597<dt>
598git grep -e '#define' --and \( -e MAX_PATH -e PATH_MAX \)
599</dt>
600<dd>
601<p>
602 Looks for a line that has <tt>#define</tt> and either <tt>MAX_PATH</tt> or
603 <tt>PATH_MAX</tt>.
604</p>
605</dd>
Junio C Hamanofbe00522006-10-19 05:58:48606<dt>
607git grep --all-match -e NODE -e Unexpected
608</dt>
609<dd>
610<p>
611 Looks for a line that has <tt>NODE</tt> or <tt>Unexpected</tt> in
612 files that have lines that match both.
613</p>
614</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31615</dl></div>
Junio C Hamano00442022006-08-03 00:29:36616</div>
Junio C Hamanoba4b9282008-07-06 05:20:31617<h2 id="_author">Author</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23618<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31619<div class="para"><p>Originally written by Linus Torvalds &lt;torvalds@osdl.org&gt;, later
620revamped by Junio C Hamano.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23621</div>
Junio C Hamanoba4b9282008-07-06 05:20:31622<h2 id="_documentation">Documentation</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23623<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31624<div class="para"><p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23625</div>
Junio C Hamanoba4b9282008-07-06 05:20:31626<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23627<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31628<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23629</div>
630<div id="footer">
631<div id="footer-text">
Junio C Hamanoba4b9282008-07-06 05:20:31632Last updated 2008-07-06 05:16:49 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23633</div>
634</div>
635</body>
636</html>