Skip to content

Commit 193c7aa

Browse files
committed
Merge branch 'ml/maint-grep-doc' into maint
* ml/maint-grep-doc: grep docs: document --no-index option grep docs: --cached and <tree>... are incompatible grep docs: use AsciiDoc literals consistently grep docs: pluralize "Example" section
2 parents 57c118c + 2e48fcd commit 193c7aa

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

Documentation/git-grep.txt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ git-grep - Print lines matching a pattern
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git grep' [--cached]
13-
[-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
12+
'git grep' [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
1413
[-v | --invert-match] [-h|-H] [--full-name]
1514
[-E | --extended-regexp] [-G | --basic-regexp]
1615
[-F | --fixed-strings] [-n]
@@ -21,7 +20,8 @@ SYNOPSIS
2120
[--color | --no-color]
2221
[-A <post-context>] [-B <pre-context>] [-C <context>]
2322
[-f <file>] [-e] <pattern>
24-
[--and|--or|--not|(|)|-e <pattern>...] [<tree>...]
23+
[--and|--or|--not|(|)|-e <pattern>...]
24+
[--cached | --no-index | <tree>...]
2525
[--] [<pathspec>...]
2626

2727
DESCRIPTION
@@ -33,8 +33,11 @@ registered in the index file, or blobs in given tree objects.
3333
OPTIONS
3434
-------
3535
--cached::
36-
Instead of searching in the working tree files, check
37-
the blobs registered in the index file.
36+
Instead of searching tracked files in the working tree, search
37+
blobs registered in the index file.
38+
39+
--no-index::
40+
Search files in the current directory, not just those tracked by git.
3841

3942
-a::
4043
--text::
@@ -98,8 +101,8 @@ OPTIONS
98101
--files-without-match::
99102
Instead of showing every matched line, show only the
100103
names of files that contain (or do not contain) matches.
101-
For better compatibility with 'git diff', --name-only is a
102-
synonym for --files-with-matches.
104+
For better compatibility with 'git diff', `--name-only` is a
105+
synonym for `--files-with-matches`.
103106

104107
-z::
105108
--null::
@@ -125,7 +128,7 @@ OPTIONS
125128
matches.
126129

127130
-<num>::
128-
A shortcut for specifying -C<num>.
131+
A shortcut for specifying `-C<num>`.
129132

130133
-p::
131134
--show-function::
@@ -140,7 +143,7 @@ OPTIONS
140143

141144
-e::
142145
The next parameter is the pattern. This option has to be
143-
used for patterns starting with - and should be used in
146+
used for patterns starting with `-` and should be used in
144147
scripts passing user input to grep. Multiple patterns are
145148
combined by 'or'.
146149

@@ -163,8 +166,9 @@ OPTIONS
163166
Do not output matched lines; instead, exit with status 0 when
164167
there is a match and with non-zero status when there isn't.
165168

166-
`<tree>...`::
167-
Search blobs in the trees for specified patterns.
169+
<tree>...::
170+
Instead of searching tracked files in the working tree, search
171+
blobs in the given trees.
168172

169173
\--::
170174
Signals the end of options; the rest of the parameters
@@ -174,8 +178,8 @@ OPTIONS
174178
If given, limit the search to paths matching at least one pattern.
175179
Both leading paths match and glob(7) patterns are supported.
176180

177-
Example
178-
-------
181+
Examples
182+
--------
179183

180184
git grep 'time_t' -- '*.[ch]'::
181185
Looks for `time_t` in all tracked .c and .h files in the working

0 commit comments

Comments
 (0)