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">
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">
9 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
11 border: 1px solid red;
16 margin: 1em 5% 1em 5%;
21 text-decoration: underline
;
39 h1
, h2
, h3
, h4
, h5
, h6
{
41 font-family: sans-serif
;
48 border-bottom: 2px solid silver
;
66 border: 1px solid silver
;
81 font-family: sans-serif
;
88 font-family: sans-serif
;
92 font-family: sans-serif
;
94 border-top: 2px solid silver
;
100 padding-bottom: 0.5em;
104 padding-bottom: 0.5em;
108 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
109 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
110 div
.admonitionblock
{
113 margin-bottom: 1.5em;
115 div
.admonitionblock
{
117 margin-bottom: 2.5em;
120 div
.content
{ /* Block element content. */
124 /* Block element titles. */
125 div
.title
, caption
.title
{
126 font-family: sans-serif
;
130 margin-bottom: 0.5em;
136 td div
.title:first-child
{
139 div
.content div
.title:first-child
{
142 div
.content
+ div
.title
{
146 div
.sidebarblock
> div
.content
{
148 border: 1px solid silver
;
155 div
.listingblock
> div
.content
{
156 border: 1px solid silver
;
161 div
.quoteblock
> div
.content
{
168 div
.verseblock
+ div
.attribution
{
172 div
.admonitionblock
.icon
{
176 text-decoration: underline
;
178 padding-right: 0.5em;
180 div
.admonitionblock td
.content
{
182 border-left: 2px solid silver
;
185 div
.exampleblock
> div
.content
{
186 border-left: 2px solid silver
;
190 div
.verseblock div
.content
{
194 div
.imageblock div
.content
{ padding-left: 0; }
195 div
.imageblock img
{ border: 1px solid silver
; }
196 span
.image img
{ border-style: none
; }
200 margin-bottom: 0.8em;
212 list-style-position: outside
;
215 list-style-type: lower-alpha
;
218 div
.tableblock
> table
{
219 border: 3px solid
#527bbd;
222 font-family: sans-serif
;
231 margin-bottom: 0.8em;
239 padding-right: 0.8em;
246 div#footer-badges
{ display: none
; }
251 font-family: sans-serif
;
255 margin-bottom: 0.1em;
258 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
274 include1::./stylesheets
/xhtml11-manpage
.css
[]
275 /* Workarounds for IE6's broken and incomplete CSS2. */
277 div
.sidebar-content
{
279 border: 1px solid silver
;
282 div
.sidebar-title
, div
.image-title
{
283 font-family: sans-serif
;
286 margin-bottom: 0.5em;
289 div
.listingblock div
.content
{
290 border: 1px solid silver
;
295 div
.quoteblock-content
{
299 div
.exampleblock-content
{
300 border-left: 2px solid silver
;
304 /* IE6 sets dynamically generated links as visited. */
305 div#toc
a:visited
{ color: blue
; }
307 <title>git-grep(
1)
</title>
312 git-grep(
1) Manual Page
315 <div class=
"sectionbody">
317 Print lines matching a pattern
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]
331 [-c | --count] [--all-match]
332 [--max-depth
<depth
>]
333 [--color | --no-color]
334 [-A
<post-context
>] [-B
<pre-context
>] [-C
<context
>]
335 [-f
<file
>] [-e]
<pattern
>
336 [--and|--or|--not|(|)|-e
<pattern
>…] [
<tree
>…]
337 [--] [
<path
>…]
</div></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>
344 <h2 id=
"_options">OPTIONS
</h2>
345 <div class=
"sectionbody">
346 <div class=
"vlist"><dl>
352 Instead of searching in the working tree files, check
353 the blobs registered in the index file.
364 Process binary files as if they were text.
375 Ignore case differences between the patterns and the
384 Don't match the pattern in binary files.
388 --max-depth
<depth
>
392 For each pathspec given on command line, descend at most
<depth
>
393 levels of directories. A negative value means no limit.
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).
417 Select non-matching lines.
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
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
460 Use POSIX extended/basic regexp for patterns. Default
461 is to use basic regexp.
472 Use fixed strings for patterns (don't interpret pattern
481 Prefix the line number to matching lines.
497 --files-without-match
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.
515 Output \
0 instead of the character that normally follows a
527 Instead of showing every matched line, show the number of
536 Show colored matches.
544 Turn off match highlighting, even when the configuration file
545 gives the default to color output.
549 -[ABC]
<context
>
553 Show
<tt>context
</tt> trailing (
<tt>A
</tt> — after), or leading (
<tt>B
</tt>
554 — before), or both (
<tt>C
</tt> — context) lines, and place a
555 line containing
<tt>--
</tt> between contiguous groups of
564 A shortcut for specifying -C
<num
>.
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>).
587 Read patterns from
<file
>, one per line.
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>.
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
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.
632 <tt><tree
>…</tt>
636 Search blobs in the trees for specified patterns.
644 Signals the end of options; the rest of the parameters
645 are
<path
> limiters.
650 <h2 id=
"_example">Example
</h2>
651 <div class=
"sectionbody">
652 <div class=
"vlist"><dl>
654 git grep -e '#define' --and \( -e MAX_PATH -e PATH_MAX \)
658 Looks for a line that has
<tt>#define
</tt> and either
<tt>MAX_PATH
</tt> or
663 git grep --all-match -e NODE -e Unexpected
667 Looks for a line that has
<tt>NODE
</tt> or
<tt>Unexpected
</tt> in
668 files that have lines that match both.
673 <h2 id=
"_author">Author
</h2>
674 <div class=
"sectionbody">
675 <div class=
"para"><p>Originally written by Linus Torvalds
<torvalds@osdl.org
>, later
676 revamped by Junio C Hamano.
</p></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
<git@vger.kernel.org
>.
</p></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>
687 <div id=
"footer-text">
688 Last updated
2009-
08-
11 06:
23:
33 UTC