Using a different application to colourize diff ou

2019-05-05 22:20发布

I want to use cdiff to colourize my diff output when using git. I could pass the output from git commands through cdiff, but I'd like to know if it's possible to not have to do this.

Specifically, when I use git log -p, I want it to use cdiff to colourize the output, when I use git commit -p, I want it to use cdiff to colourize the output. I'd like to tell git to not do the colouring itself, and to instead use this extra programme.

How do I do this?

1条回答
贼婆χ
2楼-- · 2019-05-05 22:31

From what I can see, git produces its ANSI escape codes itself, without delegating to any third party tool: I don't see an easy way in git config to transfer that to an external program.
See for instance "contrib/completion/git-prompt.sh" (tested in t/t4026-color.sh).

Then Git calls the pager which you can configure as shown in "ANSI color in git is not displayed correctly".

查看更多
登录 后发表回答