[Git] Show line numbers with git grep

Created on November 28, 2026

Use the -n option to show line numbers with git grep.

git grep -n hoge

The following output shows that the match occurs on line 2 of sample.txt.

sample.txt:2:hoge
Git