6 git-grep - Print lines matching a pattern
13 [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
14 [-v | --invert-match] [-h|-H] [--full-name]
15 [-E | --extended-regexp] [-G | --basic-regexp] [-F | --fixed-strings]
16 [-n] [-l | --files-with-matches] [-L | --files-without-match]
17 [-c | --count] [--all-match]
18 [-A <post-context>] [-B <pre-context>] [-C <context>]
19 [-f <file>] [-e] <pattern> [--and|--or|--not|(|)|-e <pattern>...]
25 Look for specified patterns in the working tree files, blobs
26 registered in the index file, or given tree objects.
32 Instead of searching in the working tree files, check
33 the blobs registered in the index file.
36 Process binary files as if they were text.
39 Ignore case differences between the patterns and the
43 Match the pattern only at word boundary (either begin at the
44 beginning of a line, or preceded by a non-word character; end at
45 the end of a line or followed by a non-word character).
48 Select non-matching lines.
51 By default, the command shows the filename for each
52 match. `-h` option is used to suppress this output.
53 `-H` is there for completeness and does not do anything
54 except it overrides `-h` given earlier on the command
58 When run from a subdirectory, the command usually
59 outputs paths relative to the current directory. This
60 option forces paths to be output relative to the project
63 -E | --extended-regexp | -G | --basic-regexp::
64 Use POSIX extended/basic regexp for patterns. Default
65 is to use basic regexp.
68 Prefix the line number to matching lines.
70 -l | --files-with-matches | -L | --files-without-match::
71 Instead of showing every matched line, show only the
72 names of files that contain (or do not contain) matches.
75 Instead of showing every matched line, show the number of
79 Show `context` trailing (`A` -- after), or leading (`B`
80 -- before), or both (`C` -- context) lines, and place a
81 line containing `--` between contiguous groups of
85 Read patterns from <file>, one per line.
88 The next parameter is the pattern. This option has to be
89 used for patterns starting with - and should be used in
90 scripts passing user input to grep. Multiple patterns are
93 --and | --or | --not | ( | )::
94 Specify how multiple patterns are combined using boolean
95 expressions. `--or` is the default operator. `--and` has
96 higher precedence than `--or`. `-e` has to be used for all
100 When giving multiple pattern expressions combined with `--or`,
101 this flag is specified to limit the match to files that
102 have lines to match all of them.
105 Search blobs in the trees for specified patterns.
108 Signals the end of options; the rest of the parameters
115 git grep -e \'#define\' --and \( -e MAX_PATH -e PATH_MAX \)::
116 Looks for a line that has `#define` and either `MAX_PATH` or
119 git grep --all-match -e NODE -e Unexpected::
120 Looks for a line that has `NODE` or `Unexpected` in
121 files that have lines that match both.
125 Originally written by Linus Torvalds <torvalds@osdl.org>, later
126 revamped by Junio C Hamano.
131 Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
135 Part of the gitlink:git[7] suite