I would like to preserve the coloring of an arbitrary command (in my case and perhaps relevant to the question, git diff
) when piping to grep
, so that grep
does not apply any additional coloring of its own and preserves the original.
For example, suppose the output of git diff
contained
- hello world
+ goodbye world
which would color the -
line red and +
line green. I would like the result of git diff | grep world
to maintain the red and green coloring.