From: Junio C Hamano Date: Wed, 24 Feb 2010 23:33:23 +0000 (-0800) Subject: Merge branch 'ml/maint-grep-doc' into maint X-Git-Tag: v1.7.0.1~5 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d951615daa9de25687fc4af34a224f62f8d414e5?ds=inline;hp=-c Merge branch 'ml/maint-grep-doc' into maint * ml/maint-grep-doc: grep documentation: clarify what files match --- d951615daa9de25687fc4af34a224f62f8d414e5 diff --combined Documentation/git-grep.txt index e019e760b4,fa91e8bebd..c44724d03a --- a/Documentation/git-grep.txt +++ b/Documentation/git-grep.txt @@@ -16,18 -16,18 +16,18 @@@ SYNOPSI [-F | --fixed-strings] [-n] [-l | --files-with-matches] [-L | --files-without-match] [-z | --null] - [-c | --count] [--all-match] + [-c | --count] [--all-match] [-q | --quiet] [--max-depth ] [--color | --no-color] [-A ] [-B ] [-C ] [-f ] [-e] [--and|--or|--not|(|)|-e ...] [...] - [--] [...] + [--] [...] DESCRIPTION ----------- - Look for specified patterns in the working tree files, blobs - registered in the index file, or given tree objects. + Look for specified patterns in the tracked files in the work tree, blobs + registered in the index file, or blobs in given tree objects. OPTIONS @@@ -49,7 -49,7 +49,7 @@@ Don't match the pattern in binary files. --max-depth :: - For each pathspec given on command line, descend at most + For each given on command line, descend at most levels of directories. A negative value means no limit. -w:: @@@ -98,7 -98,7 +98,7 @@@ --files-without-match:: Instead of showing every matched line, show only the names of files that contain (or do not contain) matches. - For better compatibility with 'git-diff', --name-only is a + For better compatibility with 'git diff', --name-only is a synonym for --files-with-matches. -z:: @@@ -158,22 -158,24 +158,29 @@@ this flag is specified to limit the match to files that have lines to match all of them. +-q:: +--quiet:: + Do not output matched lines; instead, exit with status 0 when + there is a match and with non-zero status when there isn't. + `...`:: Search blobs in the trees for specified patterns. \--:: Signals the end of options; the rest of the parameters - are limiters. + are limiters. + ...:: + If given, limit the search to paths matching at least one pattern. + Both leading paths match and glob(7) patterns are supported. Example ------- + git grep 'time_t' -- '*.[ch]':: + Looks for `time_t` in all tracked .c and .h files in the working + directory and its subdirectories. + git grep -e \'#define\' --and \( -e MAX_PATH -e PATH_MAX \):: Looks for a line that has `#define` and either `MAX_PATH` or `PATH_MAX`.