Merge branch 'jc/grep'
[git/git.git] / Documentation / git-grep.txt
CommitLineData
2aba319a
JH
1git-grep(1)
2===========
2aba319a
JH
3
4NAME
5----
5001422d 6git-grep - Print lines matching a pattern
2aba319a
JH
7
8
9SYNOPSIS
10--------
1c57119c
JH
11[verse]
12'git-grep' [--cached]
13 [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
14 [-v | --invert-match]
07ea91d8 15 [-E | --extended-regexp] [-G | --basic-regexp] [-F | --fixed-strings]
1c57119c
JH
16 [-n] [-l | --files-with-matches] [-L | --files-without-match]
17 [-c | --count]
18 [-A <post-context>] [-B <pre-context>] [-C <context>]
19 [-f <file>] [-e <pattern>]
20 [<tree>...]
21 [--] [<path>...]
2aba319a
JH
22
23DESCRIPTION
24-----------
1c57119c
JH
25Look for specified patterns in the working tree files, blobs
26registered in the index file, or given tree objects.
2aba319a
JH
27
28
29OPTIONS
30-------
1c57119c
JH
31--cached::
32 Instead of searching in the working tree files, check
33 the blobs registerd in the index file.
34
35-a | --text::
36 Process binary files as if they were text.
37
38-i | --ignore-case::
39 Ignore case differences between the patterns and the
40 files.
41
42-w | --word-regexp::
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).
46
47-v | --invert-match::
48 Select non-matching lines.
49
50-E | --extended-regexp | -G | --basic-regexp::
51 Use POSIX extended/basic regexp for patterns. Default
52 is to use basic regexp.
5b2bcc7b 53
1c57119c
JH
54-n::
55 Prefix the line number to matching lines.
2aba319a 56
1c57119c
JH
57-l | --files-with-matches | -L | --files-without-match::
58 Instead of showing every matched line, show only the
59 names of files that contain (or do not contain) matches.
2aba319a 60
1c57119c
JH
61-c | --count::
62 Instead of showing every matched line, show the number of
63 lines that match.
64
65-[ABC] <context>::
66 Show `context` trailing (`A` -- after), or leading (`B`
67 -- before), or both (`C` -- context) lines, and place a
68 line containing `--` between continguous groups of
69 matches.
70
71-f <file>::
72 Read patterns from <file>, one per line.
73
74`<tree>...`::
75 Search blobs in the trees for specified patterns.
76
77`--`::
78 Signals the end of options; the rest of the parameters
79 are <path> limiters.
2aba319a
JH
80
81
82Author
83------
1c57119c
JH
84Originally written by Linus Torvalds <torvalds@osdl.org>, later
85revamped by Junio C Hamano.
86
2aba319a
JH
87
88Documentation
89--------------
90Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
91
92GIT
93---
a7154e91 94Part of the gitlink:git[7] suite
2aba319a 95