使用其他应用程序对git中的差异输出进行着色 [英] Using a different application to colourize diff output in git

查看:62
本文介绍了使用其他应用程序对git中的差异输出进行着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用git时,我想使用 cdiff 为我的差异输出着色。我可以将git命令的输出通过cdiff传递,但我想知道是否有可能不必这样做。

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.

具体来说,当我使用 git log -p ,我希望它使用cdiff来使输出着色,当我使用 git commit -p 时,我想要使用cdiff对输出着色。我想告诉git不要自己着色,而是使用这个额外的程序。

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.

我该怎么做?

推荐答案

据我所知,git产生了 ANSI转义代码本身,而没有委托给任何第三方工具:在 git config 会将其转移到外部程序。

例如参见 contrib / completion / git-prompt.sh (在 t / t4026-color.sh )。

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

然后Git调用您可以配置的寻呼机,如 git中的ANSI颜色未正确显示

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

这篇关于使用其他应用程序对git中的差异输出进行着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆