@@ -22,12 +22,12 @@ SYNOPSIS
22
22
[-A <post-context>] [-B <pre-context>] [-C <context>]
23
23
[-f <file>] [-e] <pattern>
24
24
[--and|--or|--not|(|)|-e <pattern>...] [<tree>...]
25
- [--] [<path >...]
25
+ [--] [<pathspec >...]
26
26
27
27
DESCRIPTION
28
28
-----------
29
- Look for specified patterns in the working tree files, blobs
30
- registered in the index file, or given tree objects.
29
+ Look for specified patterns in the tracked files in the work tree , blobs
30
+ registered in the index file, or blobs in given tree objects.
31
31
32
32
33
33
OPTIONS
@@ -49,7 +49,7 @@ OPTIONS
49
49
Don't match the pattern in binary files.
50
50
51
51
--max-depth <depth>::
52
- For each pathspec given on command line, descend at most <depth>
52
+ For each < pathspec> given on command line, descend at most <depth>
53
53
levels of directories. A negative value means no limit.
54
54
55
55
-w::
@@ -168,12 +168,19 @@ OPTIONS
168
168
169
169
\--::
170
170
Signals the end of options; the rest of the parameters
171
- are <path > limiters.
171
+ are <pathspec > limiters.
172
172
173
+ <pathspec>...::
174
+ If given, limit the search to paths matching at least one pattern.
175
+ Both leading paths match and glob(7) patterns are supported.
173
176
174
177
Example
175
178
-------
176
179
180
+ git grep 'time_t' -- '*.[ch]'::
181
+ Looks for `time_t` in all tracked .c and .h files in the working
182
+ directory and its subdirectories.
183
+
177
184
git grep -e \'#define\' --and \( -e MAX_PATH -e PATH_MAX \)::
178
185
Looks for a line that has `#define` and either `MAX_PATH` or
179
186
`PATH_MAX`.
0 commit comments