My question is rather simple, though I have had no luck finding an answer.
I'd like to remove the leading plus/minus symbols from each line in git diff
. Before you ask why I wish to do this, allow me to outline my reasons:
git
)Is there some config option for doing this? If not, how can I do this in a way that still allows me to page through my diff less
-style?
Any insight would be greatly appreciated.
One option is to use sed
to remove the undesired character from diff, while preserving the color:
git diff --color | sed -r "s/^([^-+ ]*)[-+ ]/\\1/" | less -r
(Note that you need to remove the leading space as well, as it is emitted by diff.)