简体   繁体   中英

Using a different application to colourize diff output in git

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?

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 ".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM