blob: 391649133943153b30cea1d9fb34698f1de13a7f [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 Hamano103b5722011-01-31 05:03:456<meta name="generator" content="AsciiDoc 8.4.5" />
7<title>git-grep(1)</title>
Junio C Hamano1a4e8412005-12-27 08:17:238<style type="text/css">
9/* Debug borders */
10p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11/*
12 border: 1px solid red;
13*/
14}
15
16body {
17 margin: 1em 5% 1em 5%;
18}
19
Junio C Hamanoba4b9282008-07-06 05:20:3120a {
21 color: blue;
22 text-decoration: underline;
23}
24a:visited {
25 color: fuchsia;
26}
Junio C Hamano1a4e8412005-12-27 08:17:2327
28em {
29 font-style: italic;
Junio C Hamano103b5722011-01-31 05:03:4530 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:2331}
32
33strong {
34 font-weight: bold;
Junio C Hamano103b5722011-01-31 05:03:4535 color: #083194;
Junio C Hamano1a4e8412005-12-27 08:17:2336}
37
38tt {
39 color: navy;
40}
41
42h1, 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;
48}
49
Junio C Hamanoba4b9282008-07-06 05:20:3150h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 border-bottom: 2px solid silver;
52}
53h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2354 padding-top: 0.5em;
55}
Junio C Hamanoba4b9282008-07-06 05:20:3156h3 {
57 float: left;
58}
59h3 + * {
60 clear: left;
61}
Junio C Hamano1a4e8412005-12-27 08:17:2362
63div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
66}
67
68hr {
69 border: 1px solid silver;
70}
71
72p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
75}
76
Junio C Hamano103b5722011-01-31 05:03:4577ul, ol, li > p {
78 margin-top: 0;
79}
80
Junio C Hamano1a4e8412005-12-27 08:17:2381pre {
82 padding: 0;
83 margin: 0;
84}
85
86span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3190 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2391}
92span#email {
93}
Junio C Hamano103b5722011-01-31 05:03:4594span#revnumber, span#revdate, span#revremark {
Junio C Hamano1a4e8412005-12-27 08:17:2395 font-family: sans-serif;
96}
97
98div#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;
104}
105div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
108}
109div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
112}
113
Junio C Hamano103b5722011-01-31 05:03:45114div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
117}
Junio C Hamano1a4e8412005-12-27 08:17:23118div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120div.admonitionblock {
Junio C Hamano1a4e8412005-12-27 08:17:23121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
123}
124div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
127}
128
129div.content { /* Block element content. */
130 padding: 0;
131}
132
133/* Block element titles. */
134div.title, caption.title {
Junio C Hamano103b5722011-01-31 05:03:45135 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
141}
142div.title + * {
143 margin-top: 0;
144}
145
146td div.title:first-child {
147 margin-top: 0.0em;
148}
149div.content div.title:first-child {
150 margin-top: 0.0em;
151}
152div.content + div.title {
153 margin-top: 0.0em;
154}
155
156div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
160}
161
162div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
166}
167
Junio C Hamano103b5722011-01-31 05:03:45168div.quoteblock {
Junio C Hamano1a4e8412005-12-27 08:17:23169 padding-left: 2.0em;
Junio C Hamano103b5722011-01-31 05:03:45170 margin-right: 10%;
Junio C Hamano1a4e8412005-12-27 08:17:23171}
Junio C Hamano103b5722011-01-31 05:03:45172div.quoteblock > div.attribution {
173 padding-top: 0.5em;
Junio C Hamano1a4e8412005-12-27 08:17:23174 text-align: right;
175}
Junio C Hamano103b5722011-01-31 05:03:45176
177div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
180}
181div.verseblock > div.content {
182 white-space: pre;
183}
184div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
187}
188/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31189div.verseblock + div.attribution {
190 text-align: left;
191}
Junio C Hamano1a4e8412005-12-27 08:17:23192
193div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
200}
201div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
204}
205
206div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
209}
210
Junio C Hamano1a4e8412005-12-27 08:17:23211div.imageblock div.content { padding-left: 0; }
Junio C Hamano1a4e8412005-12-27 08:17:23212span.image img { border-style: none; }
Junio C Hamano103b5722011-01-31 05:03:45213a.image:visited { color: white; }
Junio C Hamano1a4e8412005-12-27 08:17:23214
215dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
218}
219dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
Junio C Hamano103b5722011-01-31 05:03:45222 font-style: normal;
223 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23224}
225dd > *:first-child {
Junio C Hamano103b5722011-01-31 05:03:45226 margin-top: 0.1em;
Junio C Hamano1a4e8412005-12-27 08:17:23227}
228
229ul, ol {
230 list-style-position: outside;
231}
Junio C Hamano103b5722011-01-31 05:03:45232ol.arabic {
233 list-style-type: decimal;
234}
235ol.loweralpha {
Junio C Hamano1a4e8412005-12-27 08:17:23236 list-style-type: lower-alpha;
237}
Junio C Hamano103b5722011-01-31 05:03:45238ol.upperalpha {
239 list-style-type: upper-alpha;
240}
241ol.lowerroman {
242 list-style-type: lower-roman;
243}
244ol.upperroman {
245 list-style-type: upper-roman;
246}
247
248div.compact ul, div.compact ol,
249div.compact p, div.compact p,
250div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
253}
Junio C Hamano1a4e8412005-12-27 08:17:23254
255div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31256 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23257}
258thead {
259 font-family: sans-serif;
260 font-weight: bold;
261}
262tfoot {
263 font-weight: bold;
264}
Junio C Hamano103b5722011-01-31 05:03:45265td > div.verse {
266 white-space: pre;
267}
268p.table {
269 margin-top: 0;
270}
271/* Because the table frame attribute is overriden by CSS in most browsers. */
272div.tableblock > table[frame="void"] {
273 border-style: none;
274}
275div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
278}
279div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
282}
Junio C Hamano1a4e8412005-12-27 08:17:23283
Junio C Hamano103b5722011-01-31 05:03:45284
285div.hdlist {
Junio C Hamano1a4e8412005-12-27 08:17:23286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
288}
Junio C Hamano103b5722011-01-31 05:03:45289div.hdlist tr {
290 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31291}
Junio C Hamano103b5722011-01-31 05:03:45292dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
294}
295td.hdlist1 {
Junio C Hamano1a4e8412005-12-27 08:17:23296 vertical-align: top;
Junio C Hamano103b5722011-01-31 05:03:45297 font-style: normal;
Junio C Hamano1a4e8412005-12-27 08:17:23298 padding-right: 0.8em;
Junio C Hamano103b5722011-01-31 05:03:45299 color: navy;
Junio C Hamano1a4e8412005-12-27 08:17:23300}
Junio C Hamano103b5722011-01-31 05:03:45301td.hdlist2 {
Junio C Hamano1a4e8412005-12-27 08:17:23302 vertical-align: top;
303}
Junio C Hamano103b5722011-01-31 05:03:45304div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
307}
308
309.comment {
310 background: yellow;
311}
Junio C Hamano1a4e8412005-12-27 08:17:23312
313@media print {
314 div#footer-badges { display: none; }
315}
Junio C Hamanoba4b9282008-07-06 05:20:31316
317div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
324}
325
326div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
329}
330div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
333}
334div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
337}
338div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
341}
Junio C Hamano103b5722011-01-31 05:03:45342/* Overrides for manpage documents */
343h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
348}
349h2 {
350 border-style: none;
351}
352div.sectionbody {
353 margin-left: 5%;
354}
355
356@media print {
357 div#toc { display: none; }
358}
359
Junio C Hamano1a4e8412005-12-27 08:17:23360/* Workarounds for IE6's broken and incomplete CSS2. */
361
362div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
366}
367div.sidebar-title, div.image-title {
Junio C Hamano103b5722011-01-31 05:03:45368 color: #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
373}
374
375div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
379}
380
Junio C Hamano103b5722011-01-31 05:03:45381div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
384}
385
386div.verseblock-content {
387 white-space: pre;
388}
389div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
Junio C Hamano1a4e8412005-12-27 08:17:23392}
393
394div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
397}
Junio C Hamanoba4b9282008-07-06 05:20:31398
399/* IE6 sets dynamically generated links as visited. */
400div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23401</style>
Junio C Hamano1a4e8412005-12-27 08:17:23402</head>
403<body>
404<div id="header">
405<h1>
406git-grep(1) Manual Page
407</h1>
408<h2>NAME</h2>
409<div class="sectionbody">
410<p>git-grep -
Junio C Hamano01078922006-03-10 00:31:47411 Print lines matching a pattern
Junio C Hamano1a4e8412005-12-27 08:17:23412</p>
413</div>
414</div>
Junio C Hamano103b5722011-01-31 05:03:45415<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23416<div class="sectionbody">
Junio C Hamano617fdb82006-05-16 02:14:21417<div class="verseblock">
Junio C Hamano103b5722011-01-31 05:03:45418<div class="verseblock-content"><em>git grep</em> [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
Junio C Hamano97efb002006-09-16 18:16:04419 [-v | --invert-match] [-h|-H] [--full-name]
Junio C Hamano9882a522007-04-27 08:22:22420 [-E | --extended-regexp] [-G | --basic-regexp]
Junio C Hamano084228c2011-05-30 08:13:52421 [-P | --perl-regexp]
422 [-F | --fixed-strings] [-n | --line-number]
Junio C Hamano9882a522007-04-27 08:22:22423 [-l | --files-with-matches] [-L | --files-without-match]
Junio C Hamano7d449522010-07-01 00:08:51424 [(-O | --open-files-in-pager) [&lt;pager&gt;]]
Junio C Hamanoa476efa2008-10-10 15:31:42425 [-z | --null]
Junio C Hamano83b35472010-01-29 05:02:13426 [-c | --count] [--all-match] [-q | --quiet]
Junio C Hamano9f883862009-08-11 06:23:52427 [--max-depth &lt;depth&gt;]
Junio C Hamano4aa0bcc2010-03-03 05:13:12428 [--color[=&lt;when&gt;] | --no-color]
Junio C Hamano617fdb82006-05-16 02:14:21429 [-A &lt;post-context&gt;] [-B &lt;pre-context&gt;] [-C &lt;context&gt;]
Junio C Hamano9882a522007-04-27 08:22:22430 [-f &lt;file&gt;] [-e] &lt;pattern&gt;
Junio C Hamano636c8b22010-03-07 22:25:17431 [--and|--or|--not|(|)|-e &lt;pattern&gt;&#8230;]
432 [--cached | --no-index | &lt;tree&gt;&#8230;]
Junio C Hamano103b5722011-01-31 05:03:45433 [--] [&lt;pathspec&gt;&#8230;]</div>
434<div class="verseblock-attribution">
435</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23436</div>
Junio C Hamanoba4b9282008-07-06 05:20:31437<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23438<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45439<div class="paragraph"><p>Look for specified patterns in the tracked files in the work tree, blobs
Junio C Hamano74a198f2010-02-22 00:13:31440registered in the index file, or blobs in given tree objects.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23441</div>
Junio C Hamanoa03ac862011-04-02 04:32:29442<h2 id="_configuration">CONFIGURATION</h2>
443<div class="sectionbody">
444<div class="dlist"><dl>
445<dt class="hdlist1">
446grep.lineNumber
447</dt>
448<dd>
449<p>
450 If set to true, enable <em>-n</em> option by default.
451</p>
452</dd>
453<dt class="hdlist1">
454grep.extendedRegexp
455</dt>
456<dd>
457<p>
458 If set to true, enable <em>--extended-regexp</em> option by default.
459</p>
460</dd>
461</dl></div>
462</div>
Junio C Hamanoba4b9282008-07-06 05:20:31463<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23464<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45465<div class="dlist"><dl>
466<dt class="hdlist1">
Junio C Hamano617fdb82006-05-16 02:14:21467--cached
468</dt>
469<dd>
470<p>
Junio C Hamano636c8b22010-03-07 22:25:17471 Instead of searching tracked files in the working tree, search
472 blobs registered in the index file.
473</p>
474</dd>
Junio C Hamano103b5722011-01-31 05:03:45475<dt class="hdlist1">
Junio C Hamano636c8b22010-03-07 22:25:17476--no-index
477</dt>
478<dd>
479<p>
480 Search files in the current directory, not just those tracked by git.
Junio C Hamano617fdb82006-05-16 02:14:21481</p>
482</dd>
Junio C Hamano103b5722011-01-31 05:03:45483<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47484-a
485</dt>
Junio C Hamano103b5722011-01-31 05:03:45486<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47487--text
Junio C Hamano617fdb82006-05-16 02:14:21488</dt>
489<dd>
490<p>
491 Process binary files as if they were text.
492</p>
493</dd>
Junio C Hamano103b5722011-01-31 05:03:45494<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47495-i
496</dt>
Junio C Hamano103b5722011-01-31 05:03:45497<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47498--ignore-case
Junio C Hamano617fdb82006-05-16 02:14:21499</dt>
500<dd>
501<p>
502 Ignore case differences between the patterns and the
503 files.
504</p>
505</dd>
Junio C Hamano103b5722011-01-31 05:03:45506<dt class="hdlist1">
Junio C Hamano9882a522007-04-27 08:22:22507-I
508</dt>
509<dd>
510<p>
Junio C Hamano103b5722011-01-31 05:03:45511 Don&#8217;t match the pattern in binary files.
Junio C Hamano9882a522007-04-27 08:22:22512</p>
513</dd>
Junio C Hamano103b5722011-01-31 05:03:45514<dt class="hdlist1">
Junio C Hamano9f883862009-08-11 06:23:52515--max-depth &lt;depth&gt;
516</dt>
517<dd>
518<p>
Junio C Hamano74a198f2010-02-22 00:13:31519 For each &lt;pathspec&gt; given on command line, descend at most &lt;depth&gt;
Junio C Hamano9f883862009-08-11 06:23:52520 levels of directories. A negative value means no limit.
521</p>
522</dd>
Junio C Hamano103b5722011-01-31 05:03:45523<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47524-w
525</dt>
Junio C Hamano103b5722011-01-31 05:03:45526<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47527--word-regexp
Junio C Hamano617fdb82006-05-16 02:14:21528</dt>
529<dd>
530<p>
531 Match the pattern only at word boundary (either begin at the
532 beginning of a line, or preceded by a non-word character; end at
533 the end of a line or followed by a non-word character).
534</p>
535</dd>
Junio C Hamano103b5722011-01-31 05:03:45536<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47537-v
538</dt>
Junio C Hamano103b5722011-01-31 05:03:45539<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47540--invert-match
Junio C Hamano617fdb82006-05-16 02:14:21541</dt>
542<dd>
543<p>
544 Select non-matching lines.
545</p>
546</dd>
Junio C Hamano103b5722011-01-31 05:03:45547<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47548-h
549</dt>
Junio C Hamano103b5722011-01-31 05:03:45550<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47551-H
Junio C Hamano97efb002006-09-16 18:16:04552</dt>
553<dd>
554<p>
555 By default, the command shows the filename for each
556 match. <tt>-h</tt> option is used to suppress this output.
557 <tt>-H</tt> is there for completeness and does not do anything
558 except it overrides <tt>-h</tt> given earlier on the command
559 line.
560</p>
561</dd>
Junio C Hamano103b5722011-01-31 05:03:45562<dt class="hdlist1">
Junio C Hamano85e45fa2006-08-13 07:47:41563--full-name
564</dt>
565<dd>
566<p>
567 When run from a subdirectory, the command usually
568 outputs paths relative to the current directory. This
569 option forces paths to be output relative to the project
570 top directory.
571</p>
572</dd>
Junio C Hamano103b5722011-01-31 05:03:45573<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47574-E
575</dt>
Junio C Hamano103b5722011-01-31 05:03:45576<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47577--extended-regexp
578</dt>
Junio C Hamano103b5722011-01-31 05:03:45579<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47580-G
581</dt>
Junio C Hamano103b5722011-01-31 05:03:45582<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47583--basic-regexp
Junio C Hamano617fdb82006-05-16 02:14:21584</dt>
585<dd>
586<p>
587 Use POSIX extended/basic regexp for patterns. Default
588 is to use basic regexp.
589</p>
590</dd>
Junio C Hamano103b5722011-01-31 05:03:45591<dt class="hdlist1">
Junio C Hamano084228c2011-05-30 08:13:52592-P
593</dt>
594<dt class="hdlist1">
595--perl-regexp
596</dt>
597<dd>
598<p>
599 Use Perl-compatible regexp for patterns. Requires libpcre to be
600 compiled in.
601</p>
602</dd>
603<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47604-F
605</dt>
Junio C Hamano103b5722011-01-31 05:03:45606<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47607--fixed-strings
Junio C Hamano9882a522007-04-27 08:22:22608</dt>
609<dd>
610<p>
Junio C Hamano103b5722011-01-31 05:03:45611 Use fixed strings for patterns (don&#8217;t interpret pattern
Junio C Hamano9882a522007-04-27 08:22:22612 as a regex).
613</p>
614</dd>
Junio C Hamano103b5722011-01-31 05:03:45615<dt class="hdlist1">
Junio C Hamano617fdb82006-05-16 02:14:21616-n
617</dt>
Junio C Hamano2906d342011-03-29 02:19:17618<dt class="hdlist1">
619--line-number
620</dt>
Junio C Hamano617fdb82006-05-16 02:14:21621<dd>
622<p>
623 Prefix the line number to matching lines.
624</p>
625</dd>
Junio C Hamano103b5722011-01-31 05:03:45626<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47627-l
628</dt>
Junio C Hamano103b5722011-01-31 05:03:45629<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47630--files-with-matches
631</dt>
Junio C Hamano103b5722011-01-31 05:03:45632<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47633--name-only
634</dt>
Junio C Hamano103b5722011-01-31 05:03:45635<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47636-L
637</dt>
Junio C Hamano103b5722011-01-31 05:03:45638<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47639--files-without-match
Junio C Hamano617fdb82006-05-16 02:14:21640</dt>
641<dd>
642<p>
643 Instead of showing every matched line, show only the
644 names of files that contain (or do not contain) matches.
Junio C Hamano636c8b22010-03-07 22:25:17645 For better compatibility with <em>git diff</em>, <tt>--name-only</tt> is a
646 synonym for <tt>--files-with-matches</tt>.
Junio C Hamano617fdb82006-05-16 02:14:21647</p>
648</dd>
Junio C Hamano103b5722011-01-31 05:03:45649<dt class="hdlist1">
Junio C Hamano7d449522010-07-01 00:08:51650-O [&lt;pager&gt;]
651</dt>
Junio C Hamano103b5722011-01-31 05:03:45652<dt class="hdlist1">
Junio C Hamano7d449522010-07-01 00:08:51653--open-files-in-pager [&lt;pager&gt;]
654</dt>
655<dd>
656<p>
657 Open the matching files in the pager (not the output of <em>grep</em>).
658 If the pager happens to be "less" or "vi", and the user
659 specified only one pattern, the first file is positioned at
660 the first match automatically.
661</p>
662</dd>
Junio C Hamano103b5722011-01-31 05:03:45663<dt class="hdlist1">
Junio C Hamanoa476efa2008-10-10 15:31:42664-z
665</dt>
Junio C Hamano103b5722011-01-31 05:03:45666<dt class="hdlist1">
Junio C Hamanoa476efa2008-10-10 15:31:42667--null
668</dt>
669<dd>
670<p>
671 Output \0 instead of the character that normally follows a
672 file name.
673</p>
674</dd>
Junio C Hamano103b5722011-01-31 05:03:45675<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47676-c
677</dt>
Junio C Hamano103b5722011-01-31 05:03:45678<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47679--count
Junio C Hamano617fdb82006-05-16 02:14:21680</dt>
681<dd>
682<p>
683 Instead of showing every matched line, show the number of
684 lines that match.
685</p>
686</dd>
Junio C Hamano103b5722011-01-31 05:03:45687<dt class="hdlist1">
Junio C Hamano4aa0bcc2010-03-03 05:13:12688--color[=&lt;when&gt;]
Junio C Hamanod257cff2009-03-18 05:27:16689</dt>
690<dd>
691<p>
692 Show colored matches.
Junio C Hamano4aa0bcc2010-03-03 05:13:12693 The value must be always (the default), never, or auto.
Junio C Hamanod257cff2009-03-18 05:27:16694</p>
695</dd>
Junio C Hamano103b5722011-01-31 05:03:45696<dt class="hdlist1">
Junio C Hamanod257cff2009-03-18 05:27:16697--no-color
698</dt>
699<dd>
700<p>
701 Turn off match highlighting, even when the configuration file
702 gives the default to color output.
Junio C Hamano4aa0bcc2010-03-03 05:13:12703 Same as <tt>--color=never</tt>.
Junio C Hamanod257cff2009-03-18 05:27:16704</p>
705</dd>
Junio C Hamano103b5722011-01-31 05:03:45706<dt class="hdlist1">
Junio C Hamano4c4b0122011-06-30 01:19:32707--break
708</dt>
709<dd>
710<p>
711 Print an empty line between matches from different files.
712</p>
713</dd>
714<dt class="hdlist1">
715--heading
716</dt>
717<dd>
718<p>
719 Show the filename above the matches in that file instead of
720 at the start of each shown line.
721</p>
722</dd>
723<dt class="hdlist1">
Junio C Hamano617fdb82006-05-16 02:14:21724-[ABC] &lt;context&gt;
725</dt>
726<dd>
727<p>
Junio C Hamano103b5722011-01-31 05:03:45728 Show <tt>context</tt> trailing (<tt>A</tt>&#8201;&#8212;&#8201;after), or leading (<tt>B</tt>
729 &#8201;&#8212;&#8201;before), or both (<tt>C</tt>&#8201;&#8212;&#8201;context) lines, and place a
Junio C Hamano341071d2006-06-04 07:24:48730 line containing <tt>--</tt> between contiguous groups of
Junio C Hamano617fdb82006-05-16 02:14:21731 matches.
732</p>
733</dd>
Junio C Hamano103b5722011-01-31 05:03:45734<dt class="hdlist1">
Junio C Hamano9882a522007-04-27 08:22:22735-&lt;num&gt;
736</dt>
737<dd>
738<p>
Junio C Hamano636c8b22010-03-07 22:25:17739 A shortcut for specifying <tt>-C&lt;num&gt;</tt>.
Junio C Hamano9882a522007-04-27 08:22:22740</p>
741</dd>
Junio C Hamano103b5722011-01-31 05:03:45742<dt class="hdlist1">
Junio C Hamano48bc1ce2009-07-09 16:49:19743-p
744</dt>
Junio C Hamano103b5722011-01-31 05:03:45745<dt class="hdlist1">
Junio C Hamano48bc1ce2009-07-09 16:49:19746--show-function
747</dt>
748<dd>
749<p>
750 Show the preceding line that contains the function name of
751 the match, unless the matching line is a function name itself.
752 The name is determined in the same way as <em>git diff</em> works out
753 patch hunk headers (see <em>Defining a custom hunk-header</em> in
754 <a href="gitattributes.html">gitattributes(5)</a>).
755</p>
756</dd>
Junio C Hamano103b5722011-01-31 05:03:45757<dt class="hdlist1">
Junio C Hamano617fdb82006-05-16 02:14:21758-f &lt;file&gt;
759</dt>
760<dd>
761<p>
762 Read patterns from &lt;file&gt;, one per line.
763</p>
764</dd>
Junio C Hamano103b5722011-01-31 05:03:45765<dt class="hdlist1">
Junio C Hamano3901ffb2006-06-26 23:46:53766-e
767</dt>
768<dd>
769<p>
770 The next parameter is the pattern. This option has to be
Junio C Hamano636c8b22010-03-07 22:25:17771 used for patterns starting with <tt>-</tt> and should be used in
Junio C Hamano00442022006-08-03 00:29:36772 scripts passing user input to grep. Multiple patterns are
773 combined by <em>or</em>.
774</p>
775</dd>
Junio C Hamano103b5722011-01-31 05:03:45776<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47777--and
778</dt>
Junio C Hamano103b5722011-01-31 05:03:45779<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47780--or
781</dt>
Junio C Hamano103b5722011-01-31 05:03:45782<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47783--not
784</dt>
Junio C Hamano103b5722011-01-31 05:03:45785<dt class="hdlist1">
Junio C Hamanoeb415992008-06-08 22:49:47786( &#8230; )
Junio C Hamano00442022006-08-03 00:29:36787</dt>
788<dd>
789<p>
Junio C Hamanof9771f62007-01-17 17:42:30790 Specify how multiple patterns are combined using Boolean
Junio C Hamano00442022006-08-03 00:29:36791 expressions. <tt>--or</tt> is the default operator. <tt>--and</tt> has
792 higher precedence than <tt>--or</tt>. <tt>-e</tt> has to be used for all
793 patterns.
Junio C Hamano3901ffb2006-06-26 23:46:53794</p>
795</dd>
Junio C Hamano103b5722011-01-31 05:03:45796<dt class="hdlist1">
Junio C Hamanofbe00522006-10-19 05:58:48797--all-match
798</dt>
799<dd>
800<p>
801 When giving multiple pattern expressions combined with <tt>--or</tt>,
802 this flag is specified to limit the match to files that
803 have lines to match all of them.
804</p>
805</dd>
Junio C Hamano103b5722011-01-31 05:03:45806<dt class="hdlist1">
Junio C Hamano83b35472010-01-29 05:02:13807-q
808</dt>
Junio C Hamano103b5722011-01-31 05:03:45809<dt class="hdlist1">
Junio C Hamano83b35472010-01-29 05:02:13810--quiet
811</dt>
812<dd>
813<p>
814 Do not output matched lines; instead, exit with status 0 when
Junio C Hamano103b5722011-01-31 05:03:45815 there is a match and with non-zero status when there isn&#8217;t.
Junio C Hamano83b35472010-01-29 05:02:13816</p>
817</dd>
Junio C Hamano103b5722011-01-31 05:03:45818<dt class="hdlist1">
Junio C Hamano636c8b22010-03-07 22:25:17819&lt;tree&gt;&#8230;
Junio C Hamano617fdb82006-05-16 02:14:21820</dt>
821<dd>
822<p>
Junio C Hamano636c8b22010-03-07 22:25:17823 Instead of searching tracked files in the working tree, search
824 blobs in the given trees.
Junio C Hamano617fdb82006-05-16 02:14:21825</p>
826</dd>
Junio C Hamano103b5722011-01-31 05:03:45827<dt class="hdlist1">
Junio C Hamano00442022006-08-03 00:29:36828--
Junio C Hamanoa6331a82006-01-22 07:50:33829</dt>
830<dd>
831<p>
832 Signals the end of options; the rest of the parameters
Junio C Hamano74a198f2010-02-22 00:13:31833 are &lt;pathspec&gt; limiters.
834</p>
835</dd>
Junio C Hamano103b5722011-01-31 05:03:45836<dt class="hdlist1">
Junio C Hamano74a198f2010-02-22 00:13:31837&lt;pathspec&gt;&#8230;
838</dt>
839<dd>
840<p>
841 If given, limit the search to paths matching at least one pattern.
842 Both leading paths match and glob(7) patterns are supported.
Junio C Hamanoa6331a82006-01-22 07:50:33843</p>
844</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31845</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:23846</div>
Junio C Hamano636c8b22010-03-07 22:25:17847<h2 id="_examples">Examples</h2>
Junio C Hamano00442022006-08-03 00:29:36848<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45849<div class="dlist"><dl>
850<dt class="hdlist1">
Junio C Hamano16ebcd02011-08-05 00:05:45851<tt>git grep &#39;time_t&#39; -- &#39;*.[ch]&#39;</tt>
Junio C Hamano74a198f2010-02-22 00:13:31852</dt>
853<dd>
854<p>
855 Looks for <tt>time_t</tt> in all tracked .c and .h files in the working
856 directory and its subdirectories.
857</p>
858</dd>
Junio C Hamano103b5722011-01-31 05:03:45859<dt class="hdlist1">
Junio C Hamano16ebcd02011-08-05 00:05:45860<tt>git grep -e &#39;#define&#39; --and \( -e MAX_PATH -e PATH_MAX \)</tt>
Junio C Hamano00442022006-08-03 00:29:36861</dt>
862<dd>
863<p>
864 Looks for a line that has <tt>#define</tt> and either <tt>MAX_PATH</tt> or
865 <tt>PATH_MAX</tt>.
866</p>
867</dd>
Junio C Hamano103b5722011-01-31 05:03:45868<dt class="hdlist1">
Junio C Hamano16ebcd02011-08-05 00:05:45869<tt>git grep --all-match -e NODE -e Unexpected</tt>
Junio C Hamanofbe00522006-10-19 05:58:48870</dt>
871<dd>
872<p>
873 Looks for a line that has <tt>NODE</tt> or <tt>Unexpected</tt> in
874 files that have lines that match both.
875</p>
876</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31877</dl></div>
Junio C Hamano00442022006-08-03 00:29:36878</div>
Junio C Hamanoba4b9282008-07-06 05:20:31879<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23880<div class="sectionbody">
Junio C Hamano103b5722011-01-31 05:03:45881<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23882</div>
883<div id="footer">
884<div id="footer-text">
Junio C Hamano16ebcd02011-08-05 00:05:45885Last updated 2011-08-05 00:04:52 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23886</div>
887</div>
888</body>
889</html>