blob: cea318a2022510e1b5b05b595f3291052d14be82 [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 Hamanoa476efa2008-10-10 15:31:42330 [-z | --null]
Junio C Hamanofbe00522006-10-19 05:58:48331 [-c | --count] [--all-match]
Junio C Hamanod257cff2009-03-18 05:27:16332 [--color | --no-color]
Junio C Hamano617fdb82006-05-16 02:14:21333 [-A &lt;post-context&gt;] [-B &lt;pre-context&gt;] [-C &lt;context&gt;]
Junio C Hamano9882a522007-04-27 08:22:22334 [-f &lt;file&gt;] [-e] &lt;pattern&gt;
335 [--and|--or|--not|(|)|-e &lt;pattern&gt;&#8230;] [&lt;tree&gt;&#8230;]
Junio C Hamano617fdb82006-05-16 02:14:21336 [--] [&lt;path&gt;&#8230;]</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23337</div>
Junio C Hamanoba4b9282008-07-06 05:20:31338<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23339<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31340<div class="para"><p>Look for specified patterns in the working tree files, blobs
341registered in the index file, or given tree objects.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23342</div>
Junio C Hamanoba4b9282008-07-06 05:20:31343<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23344<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31345<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:23346<dt>
Junio C Hamano617fdb82006-05-16 02:14:21347--cached
348</dt>
349<dd>
350<p>
351 Instead of searching in the working tree files, check
Junio C Hamano341071d2006-06-04 07:24:48352 the blobs registered in the index file.
Junio C Hamano617fdb82006-05-16 02:14:21353</p>
354</dd>
355<dt>
Junio C Hamanoeb415992008-06-08 22:49:47356-a
357</dt>
358<dt>
359--text
Junio C Hamano617fdb82006-05-16 02:14:21360</dt>
361<dd>
362<p>
363 Process binary files as if they were text.
364</p>
365</dd>
366<dt>
Junio C Hamanoeb415992008-06-08 22:49:47367-i
368</dt>
369<dt>
370--ignore-case
Junio C Hamano617fdb82006-05-16 02:14:21371</dt>
372<dd>
373<p>
374 Ignore case differences between the patterns and the
375 files.
376</p>
377</dd>
378<dt>
Junio C Hamano9882a522007-04-27 08:22:22379-I
380</dt>
381<dd>
382<p>
383 Don't match the pattern in binary files.
384</p>
385</dd>
386<dt>
Junio C Hamanoeb415992008-06-08 22:49:47387-w
388</dt>
389<dt>
390--word-regexp
Junio C Hamano617fdb82006-05-16 02:14:21391</dt>
392<dd>
393<p>
394 Match the pattern only at word boundary (either begin at the
395 beginning of a line, or preceded by a non-word character; end at
396 the end of a line or followed by a non-word character).
397</p>
398</dd>
399<dt>
Junio C Hamanoeb415992008-06-08 22:49:47400-v
401</dt>
402<dt>
403--invert-match
Junio C Hamano617fdb82006-05-16 02:14:21404</dt>
405<dd>
406<p>
407 Select non-matching lines.
408</p>
409</dd>
410<dt>
Junio C Hamanoeb415992008-06-08 22:49:47411-h
412</dt>
413<dt>
414-H
Junio C Hamano97efb002006-09-16 18:16:04415</dt>
416<dd>
417<p>
418 By default, the command shows the filename for each
419 match. <tt>-h</tt> option is used to suppress this output.
420 <tt>-H</tt> is there for completeness and does not do anything
421 except it overrides <tt>-h</tt> given earlier on the command
422 line.
423</p>
424</dd>
425<dt>
Junio C Hamano85e45fa2006-08-13 07:47:41426--full-name
427</dt>
428<dd>
429<p>
430 When run from a subdirectory, the command usually
431 outputs paths relative to the current directory. This
432 option forces paths to be output relative to the project
433 top directory.
434</p>
435</dd>
436<dt>
Junio C Hamanoeb415992008-06-08 22:49:47437-E
438</dt>
439<dt>
440--extended-regexp
441</dt>
442<dt>
443-G
444</dt>
445<dt>
446--basic-regexp
Junio C Hamano617fdb82006-05-16 02:14:21447</dt>
448<dd>
449<p>
450 Use POSIX extended/basic regexp for patterns. Default
451 is to use basic regexp.
452</p>
453</dd>
454<dt>
Junio C Hamanoeb415992008-06-08 22:49:47455-F
456</dt>
457<dt>
458--fixed-strings
Junio C Hamano9882a522007-04-27 08:22:22459</dt>
460<dd>
461<p>
462 Use fixed strings for patterns (don't interpret pattern
463 as a regex).
464</p>
465</dd>
466<dt>
Junio C Hamano617fdb82006-05-16 02:14:21467-n
468</dt>
469<dd>
470<p>
471 Prefix the line number to matching lines.
472</p>
473</dd>
474<dt>
Junio C Hamanoeb415992008-06-08 22:49:47475-l
476</dt>
477<dt>
478--files-with-matches
479</dt>
480<dt>
481--name-only
482</dt>
483<dt>
484-L
485</dt>
486<dt>
487--files-without-match
Junio C Hamano617fdb82006-05-16 02:14:21488</dt>
489<dd>
490<p>
491 Instead of showing every matched line, show only the
492 names of files that contain (or do not contain) matches.
Junio C Hamanoba4b9282008-07-06 05:20:31493 For better compatibility with <em>git-diff</em>, --name-only is a
Junio C Hamano074766f2008-02-22 22:57:06494 synonym for --files-with-matches.
Junio C Hamano617fdb82006-05-16 02:14:21495</p>
496</dd>
497<dt>
Junio C Hamanoa476efa2008-10-10 15:31:42498-z
499</dt>
500<dt>
501--null
502</dt>
503<dd>
504<p>
505 Output \0 instead of the character that normally follows a
506 file name.
507</p>
508</dd>
509<dt>
Junio C Hamanoeb415992008-06-08 22:49:47510-c
511</dt>
512<dt>
513--count
Junio C Hamano617fdb82006-05-16 02:14:21514</dt>
515<dd>
516<p>
517 Instead of showing every matched line, show the number of
518 lines that match.
519</p>
520</dd>
521<dt>
Junio C Hamanod257cff2009-03-18 05:27:16522--color
523</dt>
524<dd>
525<p>
526 Show colored matches.
527</p>
528</dd>
529<dt>
530--no-color
531</dt>
532<dd>
533<p>
534 Turn off match highlighting, even when the configuration file
535 gives the default to color output.
536</p>
537</dd>
538<dt>
Junio C Hamano617fdb82006-05-16 02:14:21539-[ABC] &lt;context&gt;
540</dt>
541<dd>
542<p>
543 Show <tt>context</tt> trailing (<tt>A</tt> &#8212; after), or leading (<tt>B</tt>
544 &#8212; before), or both (<tt>C</tt> &#8212; context) lines, and place a
Junio C Hamano341071d2006-06-04 07:24:48545 line containing <tt>--</tt> between contiguous groups of
Junio C Hamano617fdb82006-05-16 02:14:21546 matches.
547</p>
548</dd>
549<dt>
Junio C Hamano9882a522007-04-27 08:22:22550-&lt;num&gt;
551</dt>
552<dd>
553<p>
554 A shortcut for specifying -C&lt;num&gt;.
555</p>
556</dd>
557<dt>
Junio C Hamano617fdb82006-05-16 02:14:21558-f &lt;file&gt;
559</dt>
560<dd>
561<p>
562 Read patterns from &lt;file&gt;, one per line.
563</p>
564</dd>
565<dt>
Junio C Hamano3901ffb2006-06-26 23:46:53566-e
567</dt>
568<dd>
569<p>
570 The next parameter is the pattern. This option has to be
571 used for patterns starting with - and should be used in
Junio C Hamano00442022006-08-03 00:29:36572 scripts passing user input to grep. Multiple patterns are
573 combined by <em>or</em>.
574</p>
575</dd>
576<dt>
Junio C Hamanoeb415992008-06-08 22:49:47577--and
578</dt>
579<dt>
580--or
581</dt>
582<dt>
583--not
584</dt>
585<dt>
586( &#8230; )
Junio C Hamano00442022006-08-03 00:29:36587</dt>
588<dd>
589<p>
Junio C Hamanof9771f62007-01-17 17:42:30590 Specify how multiple patterns are combined using Boolean
Junio C Hamano00442022006-08-03 00:29:36591 expressions. <tt>--or</tt> is the default operator. <tt>--and</tt> has
592 higher precedence than <tt>--or</tt>. <tt>-e</tt> has to be used for all
593 patterns.
Junio C Hamano3901ffb2006-06-26 23:46:53594</p>
595</dd>
596<dt>
Junio C Hamanofbe00522006-10-19 05:58:48597--all-match
598</dt>
599<dd>
600<p>
601 When giving multiple pattern expressions combined with <tt>--or</tt>,
602 this flag is specified to limit the match to files that
603 have lines to match all of them.
604</p>
605</dd>
606<dt>
Junio C Hamano617fdb82006-05-16 02:14:21607<tt>&lt;tree&gt;&#8230;</tt>
608</dt>
609<dd>
610<p>
611 Search blobs in the trees for specified patterns.
612</p>
613</dd>
614<dt>
Junio C Hamano00442022006-08-03 00:29:36615--
Junio C Hamanoa6331a82006-01-22 07:50:33616</dt>
617<dd>
618<p>
619 Signals the end of options; the rest of the parameters
620 are &lt;path&gt; limiters.
621</p>
622</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31623</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:23624</div>
Junio C Hamanoba4b9282008-07-06 05:20:31625<h2 id="_example">Example</h2>
Junio C Hamano00442022006-08-03 00:29:36626<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31627<div class="vlist"><dl>
Junio C Hamano00442022006-08-03 00:29:36628<dt>
629git grep -e '#define' --and \( -e MAX_PATH -e PATH_MAX \)
630</dt>
631<dd>
632<p>
633 Looks for a line that has <tt>#define</tt> and either <tt>MAX_PATH</tt> or
634 <tt>PATH_MAX</tt>.
635</p>
636</dd>
Junio C Hamanofbe00522006-10-19 05:58:48637<dt>
638git grep --all-match -e NODE -e Unexpected
639</dt>
640<dd>
641<p>
642 Looks for a line that has <tt>NODE</tt> or <tt>Unexpected</tt> in
643 files that have lines that match both.
644</p>
645</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31646</dl></div>
Junio C Hamano00442022006-08-03 00:29:36647</div>
Junio C Hamanoba4b9282008-07-06 05:20:31648<h2 id="_author">Author</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23649<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31650<div class="para"><p>Originally written by Linus Torvalds &lt;torvalds@osdl.org&gt;, later
651revamped by Junio C Hamano.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23652</div>
Junio C Hamanoba4b9282008-07-06 05:20:31653<h2 id="_documentation">Documentation</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23654<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31655<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:23656</div>
Junio C Hamanoba4b9282008-07-06 05:20:31657<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23658<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31659<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23660</div>
661<div id="footer">
662<div id="footer-text">
Junio C Hamano9572e922009-04-02 06:52:03663Last updated 2009-04-02 06:49:53 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23664</div>
665</div>
666</body>
667</html>