Autogenerated HTML docs for v1.7.7-290-gc9e7aa
[git/jnareb-git.git] / git-grep.html
blob546e6bbaa6eaa3fbab628e408e9a6894307676db
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.5.2" />
7 <title>git-grep(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.0em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.0em;
126 margin-bottom: 2.0em;
127 margin-right: 10%;
128 color: #606060;
131 div.content { /* Block element content. */
132 padding: 0;
135 /* Block element titles. */
136 div.title, caption.title {
137 color: #527bbd;
138 font-family: sans-serif;
139 font-weight: bold;
140 text-align: left;
141 margin-top: 1.0em;
142 margin-bottom: 0.5em;
144 div.title + * {
145 margin-top: 0;
148 td div.title:first-child {
149 margin-top: 0.0em;
151 div.content div.title:first-child {
152 margin-top: 0.0em;
154 div.content + div.title {
155 margin-top: 0.0em;
158 div.sidebarblock > div.content {
159 background: #ffffee;
160 border: 1px solid silver;
161 padding: 0.5em;
164 div.listingblock > div.content {
165 border: 1px solid silver;
166 background: #f4f4f4;
167 padding: 0.5em;
170 div.quoteblock, div.verseblock {
171 padding-left: 1.0em;
172 margin-left: 1.0em;
173 margin-right: 10%;
174 border-left: 5px solid #dddddd;
175 color: #777777;
178 div.quoteblock > div.attribution {
179 padding-top: 0.5em;
180 text-align: right;
183 div.verseblock > div.content {
184 white-space: pre;
186 div.verseblock > div.attribution {
187 padding-top: 0.75em;
188 text-align: left;
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div.verseblock + div.attribution {
192 text-align: left;
195 div.admonitionblock .icon {
196 vertical-align: top;
197 font-size: 1.1em;
198 font-weight: bold;
199 text-decoration: underline;
200 color: #527bbd;
201 padding-right: 0.5em;
203 div.admonitionblock td.content {
204 padding-left: 0.5em;
205 border-left: 3px solid #dddddd;
208 div.exampleblock > div.content {
209 border-left: 3px solid #dddddd;
210 padding-left: 0.5em;
213 div.imageblock div.content { padding-left: 0; }
214 span.image img { border-style: none; }
215 a.image:visited { color: white; }
217 dl {
218 margin-top: 0.8em;
219 margin-bottom: 0.8em;
221 dt {
222 margin-top: 0.5em;
223 margin-bottom: 0;
224 font-style: normal;
225 color: navy;
227 dd > *:first-child {
228 margin-top: 0.1em;
231 ul, ol {
232 list-style-position: outside;
234 ol.arabic {
235 list-style-type: decimal;
237 ol.loweralpha {
238 list-style-type: lower-alpha;
240 ol.upperalpha {
241 list-style-type: upper-alpha;
243 ol.lowerroman {
244 list-style-type: lower-roman;
246 ol.upperroman {
247 list-style-type: upper-roman;
250 div.compact ul, div.compact ol,
251 div.compact p, div.compact p,
252 div.compact div, div.compact div {
253 margin-top: 0.1em;
254 margin-bottom: 0.1em;
257 div.tableblock > table {
258 border: 3px solid #527bbd;
260 thead, p.table.header {
261 font-family: sans-serif;
262 font-weight: bold;
264 tfoot {
265 font-weight: bold;
267 td > div.verse {
268 white-space: pre;
270 p.table {
271 margin-top: 0;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div.tableblock > table[frame="void"] {
275 border-style: none;
277 div.tableblock > table[frame="hsides"] {
278 border-left-style: none;
279 border-right-style: none;
281 div.tableblock > table[frame="vsides"] {
282 border-top-style: none;
283 border-bottom-style: none;
287 div.hdlist {
288 margin-top: 0.8em;
289 margin-bottom: 0.8em;
291 div.hdlist tr {
292 padding-bottom: 15px;
294 dt.hdlist1.strong, td.hdlist1.strong {
295 font-weight: bold;
297 td.hdlist1 {
298 vertical-align: top;
299 font-style: normal;
300 padding-right: 0.8em;
301 color: navy;
303 td.hdlist2 {
304 vertical-align: top;
306 div.hdlist.compact tr {
307 margin: 0;
308 padding-bottom: 0;
311 .comment {
312 background: yellow;
315 .footnote, .footnoteref {
316 font-size: 0.8em;
319 span.footnote, span.footnoteref {
320 vertical-align: super;
323 #footnotes {
324 margin: 20px 0 20px 0;
325 padding: 7px 0 0 0;
328 #footnotes div.footnote {
329 margin: 0 0 5px 0;
332 #footnotes hr {
333 border: none;
334 border-top: 1px solid silver;
335 height: 1px;
336 text-align: left;
337 margin-left: 0;
338 width: 20%;
339 min-width: 100px;
343 @media print {
344 div#footer-badges { display: none; }
347 div#toc {
348 margin-bottom: 2.5em;
351 div#toctitle {
352 color: #527bbd;
353 font-family: sans-serif;
354 font-size: 1.1em;
355 font-weight: bold;
356 margin-top: 1.0em;
357 margin-bottom: 0.1em;
360 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
364 div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
368 div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
372 div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
376 /* Overrides for manpage documents */
377 h1 {
378 padding-top: 0.5em;
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver;
381 border-bottom: 2px solid silver;
383 h2 {
384 border-style: none;
386 div.sectionbody {
387 margin-left: 5%;
390 @media print {
391 div#toc { display: none; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div.sidebar-content {
397 background: #ffffee;
398 border: 1px solid silver;
399 padding: 0.5em;
401 div.sidebar-title, div.image-title {
402 color: #527bbd;
403 font-family: sans-serif;
404 font-weight: bold;
405 margin-top: 0.0em;
406 margin-bottom: 0.5em;
409 div.listingblock div.content {
410 border: 1px solid silver;
411 background: #f4f4f4;
412 padding: 0.5em;
415 div.quoteblock-attribution {
416 padding-top: 0.5em;
417 text-align: right;
420 div.verseblock-content {
421 white-space: pre;
423 div.verseblock-attribution {
424 padding-top: 0.75em;
425 text-align: left;
428 div.exampleblock-content {
429 border-left: 3px solid #dddddd;
430 padding-left: 0.5em;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc a:visited { color: blue; }
435 </style>
436 <script type="text/javascript">
437 /*<![CDATA[*/
438 window.onload = function(){asciidoc.footnotes();}
439 var asciidoc = { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
449 * Version: 0.4
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
458 // toclevels = 1..4.
459 toc: function (toclevels) {
461 function getText(el) {
462 var text = "";
463 for (var i = el.firstChild; i != null; i = i.nextSibling) {
464 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
465 text += i.data;
466 else if (i.firstChild != null)
467 text += getText(i);
469 return text;
472 function TocEntry(el, text, toclevel) {
473 this.element = el;
474 this.text = text;
475 this.toclevel = toclevel;
478 function tocEntries(el, toclevels) {
479 var result = new Array;
480 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
483 // browsers).
484 var iterate = function (el) {
485 for (var i = el.firstChild; i != null; i = i.nextSibling) {
486 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
487 var mo = re.exec(i.tagName);
488 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
489 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
491 iterate(i);
495 iterate(el);
496 return result;
499 var toc = document.getElementById("toc");
500 var entries = tocEntries(document.getElementById("content"), toclevels);
501 for (var i = 0; i < entries.length; ++i) {
502 var entry = entries[i];
503 if (entry.element.id == "")
504 entry.element.id = "_toc_" + i;
505 var a = document.createElement("a");
506 a.href = "#" + entry.element.id;
507 a.appendChild(document.createTextNode(entry.text));
508 var div = document.createElement("div");
509 div.appendChild(a);
510 div.className = "toclevel" + entry.toclevel;
511 toc.appendChild(div);
513 if (entries.length == 0)
514 toc.parentNode.removeChild(toc);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: function () {
527 var cont = document.getElementById("content");
528 var noteholder = document.getElementById("footnotes");
529 var spans = cont.getElementsByTagName("span");
530 var refs = {};
531 var n = 0;
532 for (i=0; i<spans.length; i++) {
533 if (spans[i].className == "footnote") {
534 n++;
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder.innerHTML +=
539 "<div class='footnote' id='_footnote_" + n + "'>" +
540 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
541 n + "</a>. " + note + "</div>";
542 spans[i].innerHTML =
543 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
544 "' title='View footnote' class='footnote'>" + n + "</a>]";
545 var id =spans[i].getAttribute("id");
546 if (id != null) refs["#"+id] = n;
549 if (n == 0)
550 noteholder.parentNode.removeChild(noteholder);
551 else {
552 // Process footnoterefs.
553 for (i=0; i<spans.length; i++) {
554 if (spans[i].className == "footnoteref") {
555 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
556 href = href.match(/#.*/)[0]; // Because IE return full URL.
557 n = refs[href];
558 spans[i].innerHTML =
559 "[<a href='#_footnote_" + n +
560 "' title='View footnote' class='footnote'>" + n + "</a>]";
567 /*]]>*/
568 </script>
569 </head>
570 <body>
571 <div id="header">
572 <h1>
573 git-grep(1) Manual Page
574 </h1>
575 <h2>NAME</h2>
576 <div class="sectionbody">
577 <p>git-grep -
578 Print lines matching a pattern
579 </p>
580 </div>
581 </div>
582 <div id="content">
583 <h2 id="_synopsis">SYNOPSIS</h2>
584 <div class="sectionbody">
585 <div class="verseblock">
586 <div class="verseblock-content"><em>git grep</em> [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
587 [-v | --invert-match] [-h|-H] [--full-name]
588 [-E | --extended-regexp] [-G | --basic-regexp]
589 [-P | --perl-regexp]
590 [-F | --fixed-strings] [-n | --line-number]
591 [-l | --files-with-matches] [-L | --files-without-match]
592 [(-O | --open-files-in-pager) [&lt;pager&gt;]]
593 [-z | --null]
594 [-c | --count] [--all-match] [-q | --quiet]
595 [--max-depth &lt;depth&gt;]
596 [--color[=&lt;when&gt;] | --no-color]
597 [-A &lt;post-context&gt;] [-B &lt;pre-context&gt;] [-C &lt;context&gt;]
598 [-f &lt;file&gt;] [-e] &lt;pattern&gt;
599 [--and|--or|--not|(|)|-e &lt;pattern&gt;&#8230;]
600 [ [--exclude-standard] [--cached | --no-index | --untracked] | &lt;tree&gt;&#8230;]
601 [--] [&lt;pathspec&gt;&#8230;]</div>
602 <div class="verseblock-attribution">
603 </div></div>
604 </div>
605 <h2 id="_description">DESCRIPTION</h2>
606 <div class="sectionbody">
607 <div class="paragraph"><p>Look for specified patterns in the tracked files in the work tree, blobs
608 registered in the index file, or blobs in given tree objects.</p></div>
609 </div>
610 <h2 id="_configuration">CONFIGURATION</h2>
611 <div class="sectionbody">
612 <div class="dlist"><dl>
613 <dt class="hdlist1">
614 grep.lineNumber
615 </dt>
616 <dd>
618 If set to true, enable <em>-n</em> option by default.
619 </p>
620 </dd>
621 <dt class="hdlist1">
622 grep.extendedRegexp
623 </dt>
624 <dd>
626 If set to true, enable <em>--extended-regexp</em> option by default.
627 </p>
628 </dd>
629 </dl></div>
630 </div>
631 <h2 id="_options">OPTIONS</h2>
632 <div class="sectionbody">
633 <div class="dlist"><dl>
634 <dt class="hdlist1">
635 --cached
636 </dt>
637 <dd>
639 Instead of searching tracked files in the working tree, search
640 blobs registered in the index file.
641 </p>
642 </dd>
643 <dt class="hdlist1">
644 --no-index
645 </dt>
646 <dd>
648 Search files in the current directory that is not managed by git.
649 </p>
650 </dd>
651 <dt class="hdlist1">
652 --untracked
653 </dt>
654 <dd>
656 In addition to searching in the tracked files in the working
657 tree, search also in untracked files.
658 </p>
659 </dd>
660 <dt class="hdlist1">
661 --no-exclude-standard
662 </dt>
663 <dd>
665 Also search in ignored files by not honoring the <tt>.gitignore</tt>
666 mechanism. Only useful with <tt>--untracked</tt>.
667 </p>
668 </dd>
669 <dt class="hdlist1">
670 --exclude-standard
671 </dt>
672 <dd>
674 Do not pay attention to ignored files specified via the <tt>.gitignore</tt>
675 mechanism. Only useful when searching files in the current directory
676 with <tt>--no-index</tt>.
677 </p>
678 </dd>
679 <dt class="hdlist1">
681 </dt>
682 <dt class="hdlist1">
683 --text
684 </dt>
685 <dd>
687 Process binary files as if they were text.
688 </p>
689 </dd>
690 <dt class="hdlist1">
692 </dt>
693 <dt class="hdlist1">
694 --ignore-case
695 </dt>
696 <dd>
698 Ignore case differences between the patterns and the
699 files.
700 </p>
701 </dd>
702 <dt class="hdlist1">
704 </dt>
705 <dd>
707 Don&#8217;t match the pattern in binary files.
708 </p>
709 </dd>
710 <dt class="hdlist1">
711 --max-depth &lt;depth&gt;
712 </dt>
713 <dd>
715 For each &lt;pathspec&gt; given on command line, descend at most &lt;depth&gt;
716 levels of directories. A negative value means no limit.
717 </p>
718 </dd>
719 <dt class="hdlist1">
721 </dt>
722 <dt class="hdlist1">
723 --word-regexp
724 </dt>
725 <dd>
727 Match the pattern only at word boundary (either begin at the
728 beginning of a line, or preceded by a non-word character; end at
729 the end of a line or followed by a non-word character).
730 </p>
731 </dd>
732 <dt class="hdlist1">
734 </dt>
735 <dt class="hdlist1">
736 --invert-match
737 </dt>
738 <dd>
740 Select non-matching lines.
741 </p>
742 </dd>
743 <dt class="hdlist1">
745 </dt>
746 <dt class="hdlist1">
748 </dt>
749 <dd>
751 By default, the command shows the filename for each
752 match. <tt>-h</tt> option is used to suppress this output.
753 <tt>-H</tt> is there for completeness and does not do anything
754 except it overrides <tt>-h</tt> given earlier on the command
755 line.
756 </p>
757 </dd>
758 <dt class="hdlist1">
759 --full-name
760 </dt>
761 <dd>
763 When run from a subdirectory, the command usually
764 outputs paths relative to the current directory. This
765 option forces paths to be output relative to the project
766 top directory.
767 </p>
768 </dd>
769 <dt class="hdlist1">
771 </dt>
772 <dt class="hdlist1">
773 --extended-regexp
774 </dt>
775 <dt class="hdlist1">
777 </dt>
778 <dt class="hdlist1">
779 --basic-regexp
780 </dt>
781 <dd>
783 Use POSIX extended/basic regexp for patterns. Default
784 is to use basic regexp.
785 </p>
786 </dd>
787 <dt class="hdlist1">
789 </dt>
790 <dt class="hdlist1">
791 --perl-regexp
792 </dt>
793 <dd>
795 Use Perl-compatible regexp for patterns. Requires libpcre to be
796 compiled in.
797 </p>
798 </dd>
799 <dt class="hdlist1">
801 </dt>
802 <dt class="hdlist1">
803 --fixed-strings
804 </dt>
805 <dd>
807 Use fixed strings for patterns (don&#8217;t interpret pattern
808 as a regex).
809 </p>
810 </dd>
811 <dt class="hdlist1">
813 </dt>
814 <dt class="hdlist1">
815 --line-number
816 </dt>
817 <dd>
819 Prefix the line number to matching lines.
820 </p>
821 </dd>
822 <dt class="hdlist1">
824 </dt>
825 <dt class="hdlist1">
826 --files-with-matches
827 </dt>
828 <dt class="hdlist1">
829 --name-only
830 </dt>
831 <dt class="hdlist1">
833 </dt>
834 <dt class="hdlist1">
835 --files-without-match
836 </dt>
837 <dd>
839 Instead of showing every matched line, show only the
840 names of files that contain (or do not contain) matches.
841 For better compatibility with <em>git diff</em>, <tt>--name-only</tt> is a
842 synonym for <tt>--files-with-matches</tt>.
843 </p>
844 </dd>
845 <dt class="hdlist1">
846 -O [&lt;pager&gt;]
847 </dt>
848 <dt class="hdlist1">
849 --open-files-in-pager [&lt;pager&gt;]
850 </dt>
851 <dd>
853 Open the matching files in the pager (not the output of <em>grep</em>).
854 If the pager happens to be "less" or "vi", and the user
855 specified only one pattern, the first file is positioned at
856 the first match automatically.
857 </p>
858 </dd>
859 <dt class="hdlist1">
861 </dt>
862 <dt class="hdlist1">
863 --null
864 </dt>
865 <dd>
867 Output \0 instead of the character that normally follows a
868 file name.
869 </p>
870 </dd>
871 <dt class="hdlist1">
873 </dt>
874 <dt class="hdlist1">
875 --count
876 </dt>
877 <dd>
879 Instead of showing every matched line, show the number of
880 lines that match.
881 </p>
882 </dd>
883 <dt class="hdlist1">
884 --color[=&lt;when&gt;]
885 </dt>
886 <dd>
888 Show colored matches.
889 The value must be always (the default), never, or auto.
890 </p>
891 </dd>
892 <dt class="hdlist1">
893 --no-color
894 </dt>
895 <dd>
897 Turn off match highlighting, even when the configuration file
898 gives the default to color output.
899 Same as <tt>--color=never</tt>.
900 </p>
901 </dd>
902 <dt class="hdlist1">
903 --break
904 </dt>
905 <dd>
907 Print an empty line between matches from different files.
908 </p>
909 </dd>
910 <dt class="hdlist1">
911 --heading
912 </dt>
913 <dd>
915 Show the filename above the matches in that file instead of
916 at the start of each shown line.
917 </p>
918 </dd>
919 <dt class="hdlist1">
921 </dt>
922 <dt class="hdlist1">
923 --show-function
924 </dt>
925 <dd>
927 Show the preceding line that contains the function name of
928 the match, unless the matching line is a function name itself.
929 The name is determined in the same way as <em>git diff</em> works out
930 patch hunk headers (see <em>Defining a custom hunk-header</em> in
931 <a href="gitattributes.html">gitattributes(5)</a>).
932 </p>
933 </dd>
934 <dt class="hdlist1">
935 -&lt;num&gt;
936 </dt>
937 <dt class="hdlist1">
938 -C &lt;num&gt;
939 </dt>
940 <dt class="hdlist1">
941 --context &lt;num&gt;
942 </dt>
943 <dd>
945 Show &lt;num&gt; leading and trailing lines, and place a line
946 containing <tt>--</tt> between contiguous groups of matches.
947 </p>
948 </dd>
949 <dt class="hdlist1">
950 -A &lt;num&gt;
951 </dt>
952 <dt class="hdlist1">
953 --after-context &lt;num&gt;
954 </dt>
955 <dd>
957 Show &lt;num&gt; trailing lines, and place a line containing
958 <tt>--</tt> between contiguous groups of matches.
959 </p>
960 </dd>
961 <dt class="hdlist1">
962 -B &lt;num&gt;
963 </dt>
964 <dt class="hdlist1">
965 --before-context &lt;num&gt;
966 </dt>
967 <dd>
969 Show &lt;num&gt; leading lines, and place a line containing
970 <tt>--</tt> between contiguous groups of matches.
971 </p>
972 </dd>
973 <dt class="hdlist1">
975 </dt>
976 <dt class="hdlist1">
977 --function-context
978 </dt>
979 <dd>
981 Show the surrounding text from the previous line containing a
982 function name up to the one before the next function name,
983 effectively showing the whole function in which the match was
984 found.
985 </p>
986 </dd>
987 <dt class="hdlist1">
988 -f &lt;file&gt;
989 </dt>
990 <dd>
992 Read patterns from &lt;file&gt;, one per line.
993 </p>
994 </dd>
995 <dt class="hdlist1">
997 </dt>
998 <dd>
1000 The next parameter is the pattern. This option has to be
1001 used for patterns starting with <tt>-</tt> and should be used in
1002 scripts passing user input to grep. Multiple patterns are
1003 combined by <em>or</em>.
1004 </p>
1005 </dd>
1006 <dt class="hdlist1">
1007 --and
1008 </dt>
1009 <dt class="hdlist1">
1010 --or
1011 </dt>
1012 <dt class="hdlist1">
1013 --not
1014 </dt>
1015 <dt class="hdlist1">
1016 ( &#8230; )
1017 </dt>
1018 <dd>
1020 Specify how multiple patterns are combined using Boolean
1021 expressions. <tt>--or</tt> is the default operator. <tt>--and</tt> has
1022 higher precedence than <tt>--or</tt>. <tt>-e</tt> has to be used for all
1023 patterns.
1024 </p>
1025 </dd>
1026 <dt class="hdlist1">
1027 --all-match
1028 </dt>
1029 <dd>
1031 When giving multiple pattern expressions combined with <tt>--or</tt>,
1032 this flag is specified to limit the match to files that
1033 have lines to match all of them.
1034 </p>
1035 </dd>
1036 <dt class="hdlist1">
1038 </dt>
1039 <dt class="hdlist1">
1040 --quiet
1041 </dt>
1042 <dd>
1044 Do not output matched lines; instead, exit with status 0 when
1045 there is a match and with non-zero status when there isn&#8217;t.
1046 </p>
1047 </dd>
1048 <dt class="hdlist1">
1049 &lt;tree&gt;&#8230;
1050 </dt>
1051 <dd>
1053 Instead of searching tracked files in the working tree, search
1054 blobs in the given trees.
1055 </p>
1056 </dd>
1057 <dt class="hdlist1">
1059 </dt>
1060 <dd>
1062 Signals the end of options; the rest of the parameters
1063 are &lt;pathspec&gt; limiters.
1064 </p>
1065 </dd>
1066 <dt class="hdlist1">
1067 &lt;pathspec&gt;&#8230;
1068 </dt>
1069 <dd>
1071 If given, limit the search to paths matching at least one pattern.
1072 Both leading paths match and glob(7) patterns are supported.
1073 </p>
1074 </dd>
1075 </dl></div>
1076 </div>
1077 <h2 id="_examples">Examples</h2>
1078 <div class="sectionbody">
1079 <div class="dlist"><dl>
1080 <dt class="hdlist1">
1081 <tt>git grep &#39;time_t&#39; -- &#39;*.[ch]&#39;</tt>
1082 </dt>
1083 <dd>
1085 Looks for <tt>time_t</tt> in all tracked .c and .h files in the working
1086 directory and its subdirectories.
1087 </p>
1088 </dd>
1089 <dt class="hdlist1">
1090 <tt>git grep -e &#39;#define&#39; --and \( -e MAX_PATH -e PATH_MAX \)</tt>
1091 </dt>
1092 <dd>
1094 Looks for a line that has <tt>#define</tt> and either <tt>MAX_PATH</tt> or
1095 <tt>PATH_MAX</tt>.
1096 </p>
1097 </dd>
1098 <dt class="hdlist1">
1099 <tt>git grep --all-match -e NODE -e Unexpected</tt>
1100 </dt>
1101 <dd>
1103 Looks for a line that has <tt>NODE</tt> or <tt>Unexpected</tt> in
1104 files that have lines that match both.
1105 </p>
1106 </dd>
1107 </dl></div>
1108 </div>
1109 <h2 id="_git">GIT</h2>
1110 <div class="sectionbody">
1111 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1112 </div>
1113 </div>
1114 <div id="footnotes"><hr /></div>
1115 <div id="footer">
1116 <div id="footer-text">
1117 Last updated 2011-10-13 22:57:58 PDT
1118 </div>
1119 </div>
1120 </body>
1121 </html>