Autogenerated HTML docs for v1.6.5.2-74-g610f9
[git/jnareb-git.git] / git-grep.html
blobe5b749b47cf6c8e72737cc2b723d93e843747f1f
1 <!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" />
6 <meta name="generator" content="AsciiDoc 8.2.5" />
7 <style type="text/css">
8 /* Debug borders */
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11 border: 1px solid red;
15 body {
16 margin: 1em 5% 1em 5%;
19 a {
20 color: blue;
21 text-decoration: underline;
23 a:visited {
24 color: fuchsia;
27 em {
28 font-style: italic;
31 strong {
32 font-weight: bold;
35 tt {
36 color: navy;
39 h1, 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;
47 h1, h2, h3 {
48 border-bottom: 2px solid silver;
50 h2 {
51 padding-top: 0.5em;
53 h3 {
54 float: left;
56 h3 + * {
57 clear: left;
60 div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
65 hr {
66 border: 1px solid silver;
69 p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
74 pre {
75 padding: 0;
76 margin: 0;
79 span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
83 font-size: 1.1em;
85 span#email {
87 span#revision {
88 font-family: sans-serif;
91 div#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;
98 div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
102 div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
107 div#preamble,
108 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110 div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
115 div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
120 div.content { /* Block element content. */
121 padding: 0;
124 /* Block element titles. */
125 div.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;
132 div.title + * {
133 margin-top: 0;
136 td div.title:first-child {
137 margin-top: 0.0em;
139 div.content div.title:first-child {
140 margin-top: 0.0em;
142 div.content + div.title {
143 margin-top: 0.0em;
146 div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
152 div.listingblock {
153 margin-right: 0%;
155 div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
161 div.quoteblock > div.content {
162 padding-left: 2.0em;
165 div.attribution {
166 text-align: right;
168 div.verseblock + div.attribution {
169 text-align: left;
172 div.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;
180 div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
185 div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
190 div.verseblock div.content {
191 white-space: pre;
194 div.imageblock div.content { padding-left: 0; }
195 div.imageblock img { border: 1px solid silver; }
196 span.image img { border-style: none; }
198 dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
202 dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
207 dd > *:first-child {
208 margin-top: 0;
211 ul, ol {
212 list-style-position: outside;
214 div.olist2 ol {
215 list-style-type: lower-alpha;
218 div.tableblock > table {
219 border: 3px solid #527bbd;
221 thead {
222 font-family: sans-serif;
223 font-weight: bold;
225 tfoot {
226 font-weight: bold;
229 div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
233 div.hlist td {
234 padding-bottom: 5px;
236 td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
241 td.hlist2 {
242 vertical-align: top;
245 @media print {
246 div#footer-badges { display: none; }
249 div#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;
258 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
262 div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
266 div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
270 div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
274 include1::./stylesheets/xhtml11-manpage.css[]
275 /* Workarounds for IE6's broken and incomplete CSS2. */
277 div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
282 div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
289 div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
295 div.quoteblock-content {
296 padding-left: 2.0em;
299 div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
304 /* IE6 sets dynamically generated links as visited. */
305 div#toc a:visited { color: blue; }
306 </style>
307 <title>git-grep(1)</title>
308 </head>
309 <body>
310 <div id="header">
311 <h1>
312 git-grep(1) Manual Page
313 </h1>
314 <h2>NAME</h2>
315 <div class="sectionbody">
316 <p>git-grep -
317 Print lines matching a pattern
318 </p>
319 </div>
320 </div>
321 <h2>SYNOPSIS</h2>
322 <div class="sectionbody">
323 <div class="verseblock">
324 <div class="content"><em>git grep</em> [--cached]
325 [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
326 [-v | --invert-match] [-h|-H] [--full-name]
327 [-E | --extended-regexp] [-G | --basic-regexp]
328 [-F | --fixed-strings] [-n]
329 [-l | --files-with-matches] [-L | --files-without-match]
330 [-z | --null]
331 [-c | --count] [--all-match]
332 [--max-depth &lt;depth&gt;]
333 [--color | --no-color]
334 [-A &lt;post-context&gt;] [-B &lt;pre-context&gt;] [-C &lt;context&gt;]
335 [-f &lt;file&gt;] [-e] &lt;pattern&gt;
336 [--and|--or|--not|(|)|-e &lt;pattern&gt;&#8230;] [&lt;tree&gt;&#8230;]
337 [--] [&lt;path&gt;&#8230;]</div></div>
338 </div>
339 <h2 id="_description">DESCRIPTION</h2>
340 <div class="sectionbody">
341 <div class="para"><p>Look for specified patterns in the working tree files, blobs
342 registered in the index file, or given tree objects.</p></div>
343 </div>
344 <h2 id="_options">OPTIONS</h2>
345 <div class="sectionbody">
346 <div class="vlist"><dl>
347 <dt>
348 --cached
349 </dt>
350 <dd>
352 Instead of searching in the working tree files, check
353 the blobs registered in the index file.
354 </p>
355 </dd>
356 <dt>
358 </dt>
359 <dt>
360 --text
361 </dt>
362 <dd>
364 Process binary files as if they were text.
365 </p>
366 </dd>
367 <dt>
369 </dt>
370 <dt>
371 --ignore-case
372 </dt>
373 <dd>
375 Ignore case differences between the patterns and the
376 files.
377 </p>
378 </dd>
379 <dt>
381 </dt>
382 <dd>
384 Don't match the pattern in binary files.
385 </p>
386 </dd>
387 <dt>
388 --max-depth &lt;depth&gt;
389 </dt>
390 <dd>
392 For each pathspec given on command line, descend at most &lt;depth&gt;
393 levels of directories. A negative value means no limit.
394 </p>
395 </dd>
396 <dt>
398 </dt>
399 <dt>
400 --word-regexp
401 </dt>
402 <dd>
404 Match the pattern only at word boundary (either begin at the
405 beginning of a line, or preceded by a non-word character; end at
406 the end of a line or followed by a non-word character).
407 </p>
408 </dd>
409 <dt>
411 </dt>
412 <dt>
413 --invert-match
414 </dt>
415 <dd>
417 Select non-matching lines.
418 </p>
419 </dd>
420 <dt>
422 </dt>
423 <dt>
425 </dt>
426 <dd>
428 By default, the command shows the filename for each
429 match. <tt>-h</tt> option is used to suppress this output.
430 <tt>-H</tt> is there for completeness and does not do anything
431 except it overrides <tt>-h</tt> given earlier on the command
432 line.
433 </p>
434 </dd>
435 <dt>
436 --full-name
437 </dt>
438 <dd>
440 When run from a subdirectory, the command usually
441 outputs paths relative to the current directory. This
442 option forces paths to be output relative to the project
443 top directory.
444 </p>
445 </dd>
446 <dt>
448 </dt>
449 <dt>
450 --extended-regexp
451 </dt>
452 <dt>
454 </dt>
455 <dt>
456 --basic-regexp
457 </dt>
458 <dd>
460 Use POSIX extended/basic regexp for patterns. Default
461 is to use basic regexp.
462 </p>
463 </dd>
464 <dt>
466 </dt>
467 <dt>
468 --fixed-strings
469 </dt>
470 <dd>
472 Use fixed strings for patterns (don't interpret pattern
473 as a regex).
474 </p>
475 </dd>
476 <dt>
478 </dt>
479 <dd>
481 Prefix the line number to matching lines.
482 </p>
483 </dd>
484 <dt>
486 </dt>
487 <dt>
488 --files-with-matches
489 </dt>
490 <dt>
491 --name-only
492 </dt>
493 <dt>
495 </dt>
496 <dt>
497 --files-without-match
498 </dt>
499 <dd>
501 Instead of showing every matched line, show only the
502 names of files that contain (or do not contain) matches.
503 For better compatibility with <em>git-diff</em>, --name-only is a
504 synonym for --files-with-matches.
505 </p>
506 </dd>
507 <dt>
509 </dt>
510 <dt>
511 --null
512 </dt>
513 <dd>
515 Output \0 instead of the character that normally follows a
516 file name.
517 </p>
518 </dd>
519 <dt>
521 </dt>
522 <dt>
523 --count
524 </dt>
525 <dd>
527 Instead of showing every matched line, show the number of
528 lines that match.
529 </p>
530 </dd>
531 <dt>
532 --color
533 </dt>
534 <dd>
536 Show colored matches.
537 </p>
538 </dd>
539 <dt>
540 --no-color
541 </dt>
542 <dd>
544 Turn off match highlighting, even when the configuration file
545 gives the default to color output.
546 </p>
547 </dd>
548 <dt>
549 -[ABC] &lt;context&gt;
550 </dt>
551 <dd>
553 Show <tt>context</tt> trailing (<tt>A</tt> &#8212; after), or leading (<tt>B</tt>
554 &#8212; before), or both (<tt>C</tt> &#8212; context) lines, and place a
555 line containing <tt>--</tt> between contiguous groups of
556 matches.
557 </p>
558 </dd>
559 <dt>
560 -&lt;num&gt;
561 </dt>
562 <dd>
564 A shortcut for specifying -C&lt;num&gt;.
565 </p>
566 </dd>
567 <dt>
569 </dt>
570 <dt>
571 --show-function
572 </dt>
573 <dd>
575 Show the preceding line that contains the function name of
576 the match, unless the matching line is a function name itself.
577 The name is determined in the same way as <em>git diff</em> works out
578 patch hunk headers (see <em>Defining a custom hunk-header</em> in
579 <a href="gitattributes.html">gitattributes(5)</a>).
580 </p>
581 </dd>
582 <dt>
583 -f &lt;file&gt;
584 </dt>
585 <dd>
587 Read patterns from &lt;file&gt;, one per line.
588 </p>
589 </dd>
590 <dt>
592 </dt>
593 <dd>
595 The next parameter is the pattern. This option has to be
596 used for patterns starting with - and should be used in
597 scripts passing user input to grep. Multiple patterns are
598 combined by <em>or</em>.
599 </p>
600 </dd>
601 <dt>
602 --and
603 </dt>
604 <dt>
605 --or
606 </dt>
607 <dt>
608 --not
609 </dt>
610 <dt>
611 ( &#8230; )
612 </dt>
613 <dd>
615 Specify how multiple patterns are combined using Boolean
616 expressions. <tt>--or</tt> is the default operator. <tt>--and</tt> has
617 higher precedence than <tt>--or</tt>. <tt>-e</tt> has to be used for all
618 patterns.
619 </p>
620 </dd>
621 <dt>
622 --all-match
623 </dt>
624 <dd>
626 When giving multiple pattern expressions combined with <tt>--or</tt>,
627 this flag is specified to limit the match to files that
628 have lines to match all of them.
629 </p>
630 </dd>
631 <dt>
632 <tt>&lt;tree&gt;&#8230;</tt>
633 </dt>
634 <dd>
636 Search blobs in the trees for specified patterns.
637 </p>
638 </dd>
639 <dt>
641 </dt>
642 <dd>
644 Signals the end of options; the rest of the parameters
645 are &lt;path&gt; limiters.
646 </p>
647 </dd>
648 </dl></div>
649 </div>
650 <h2 id="_example">Example</h2>
651 <div class="sectionbody">
652 <div class="vlist"><dl>
653 <dt>
654 git grep -e '#define' --and \( -e MAX_PATH -e PATH_MAX \)
655 </dt>
656 <dd>
658 Looks for a line that has <tt>#define</tt> and either <tt>MAX_PATH</tt> or
659 <tt>PATH_MAX</tt>.
660 </p>
661 </dd>
662 <dt>
663 git grep --all-match -e NODE -e Unexpected
664 </dt>
665 <dd>
667 Looks for a line that has <tt>NODE</tt> or <tt>Unexpected</tt> in
668 files that have lines that match both.
669 </p>
670 </dd>
671 </dl></div>
672 </div>
673 <h2 id="_author">Author</h2>
674 <div class="sectionbody">
675 <div class="para"><p>Originally written by Linus Torvalds &lt;torvalds@osdl.org&gt;, later
676 revamped by Junio C Hamano.</p></div>
677 </div>
678 <h2 id="_documentation">Documentation</h2>
679 <div class="sectionbody">
680 <div class="para"><p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
681 </div>
682 <h2 id="_git">GIT</h2>
683 <div class="sectionbody">
684 <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
685 </div>
686 <div id="footer">
687 <div id="footer-text">
688 Last updated 2009-08-11 06:23:33 UTC
689 </div>
690 </div>
691 </body>
692 </html>