Using a different application to colourize diff output in git

余生颓废 提交于 2019-12-07 11:38:51

问题


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:


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



来源:https://stackoverflow.com/questions/21144353/using-a-different-application-to-colourize-diff-output-in-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!