I've recently found git grep
and come to like its speed and de facto searching of only the files in the repo. But coming from ack
(ack-grep
in Ubuntu), one thing left to be desired is the output formatting, which is unfortunately much more like grep
than ack
. Go figure.
ack
:
- Prints the matching filename on the first line by itself.
- Color highlights the matching filename a bold green.
- Prints the line number, and only the line number, with each matching line.
- Color highlights the line number a bold yellow.
- Color highlights each matching string a background yellow.
- Prints a blank line between matches from different files.
On the other hand, git grep
:
- Prints the filename on every matching line.
- Prints no line number.
- Prints no blank line between matches from different files.
- Color highlights only the matching text, a bold red.
Is there any set of git grep
options, or combo with other tools, that can make git grep
output look like ack
output?
ack
would be a better alias name for this. – Impearl