Skip to content

Commit 241b925

Browse files
committed
Merge branch 'ml/maint-grep-doc'
* ml/maint-grep-doc: grep documentation: clarify what files match
2 parents cab1b01 + 3ac4440 commit 241b925

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Documentation/git-grep.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ SYNOPSIS
2222
[-A <post-context>] [-B <pre-context>] [-C <context>]
2323
[-f <file>] [-e] <pattern>
2424
[--and|--or|--not|(|)|-e <pattern>...] [<tree>...]
25-
[--] [<path>...]
25+
[--] [<pathspec>...]
2626

2727
DESCRIPTION
2828
-----------
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.
3131

3232

3333
OPTIONS
@@ -49,7 +49,7 @@ OPTIONS
4949
Don't match the pattern in binary files.
5050

5151
--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>
5353
levels of directories. A negative value means no limit.
5454

5555
-w::
@@ -168,12 +168,19 @@ OPTIONS
168168

169169
\--::
170170
Signals the end of options; the rest of the parameters
171-
are <path> limiters.
171+
are <pathspec> limiters.
172172

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.
173176

174177
Example
175178
-------
176179

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+
177184
git grep -e \'#define\' --and \( -e MAX_PATH -e PATH_MAX \)::
178185
Looks for a line that has `#define` and either `MAX_PATH` or
179186
`PATH_MAX`.

0 commit comments

Comments
 (0)