Skip to content

Commit 7d6cb10

Browse files
jratt0gitster
authored andcommitted
grep: Add the option '--line-number'
This is a synonym for the existing '-n' option, matching GNU grep. Signed-off-by: Joe Ratterman <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 78bc466 commit 7d6cb10

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Documentation/git-grep.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ OPTIONS
9393
as a regex).
9494

9595
-n::
96+
--line-number::
9697
Prefix the line number to matching lines.
9798

9899
-l::

builtin/grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
864864
OPT_BOOLEAN('F', "fixed-strings", &opt.fixed,
865865
"interpret patterns as fixed strings"),
866866
OPT_GROUP(""),
867-
OPT_BOOLEAN('n', NULL, &opt.linenum, "show line numbers"),
867+
OPT_BOOLEAN('n', "line-number", &opt.linenum, "show line numbers"),
868868
OPT_NEGBIT('h', NULL, &opt.pathname, "don't show filenames", 1),
869869
OPT_BIT('H', NULL, &opt.pathname, "show filenames", 1),
870870
OPT_NEGBIT(0, "full-name", &opt.relative,

0 commit comments

Comments
 (0)