简体   繁体   English

Mac:git diff-更好的色彩?

[英]Mac: git diff - better colors?

Is there a way to get better colors for git diff on a Mac? 有没有办法在Mac上为git diff获得更好的颜色? Something more like Linux' colors. 更像是Linux的颜色。 In the diff, the lines that are removed are highlighted and colored, but added lines are grey. 在差异中,被删除的行被突出显示和着色,但是添加的行为灰色。 Grey?! 灰色?! :) (Granted, it's slightly bolded, but it's still hard to parse through the information when it's grey...) :)(允许,它以粗体显示,但是当信息显示为灰色时,仍然很难解析该信息...)

Thanks! 谢谢!

The style of the parts of Git's diff are set with the color.diff.<slot> config parameters, where <slot> is the part of the diff, in this case new . Git差异部分的样式由color.diff.<slot>配置参数设置,其中<slot>是差异部分,在本例中为new git help config provides further information, but in short, set something like this in your Git config file: git help config提供了更多信息,但简而言之,请在您的Git配置文件中设置以下内容:

[color "diff"]
    new = green

Or to set it with a command: 或使用命令进行设置:

git config --global color.diff.new green

If, for some reason, you only want to set it in a certain repo, just run it without --global . 如果由于某种原因,您只想将其设置在某个存储库中,请在不使用--global情况下运行它。

I recommend spending some time reading the configuration documentation: There are many things one can set in one's Git configuration to make Git more like one wants it. 我建议花一些时间阅读配置文档:可以在自己的Git配置中进行很多设置,以使Git更像人们想要的那样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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