如何在Ubuntu中着色Git控制台?
我最近看到,Windows中的Git控制台是有颜色的,例如绿色表示增加,红色表示删除等。如何为我的Ubuntu Git控制台添加颜色?
要安装它,我使用了命令: $ sudo apt-get install git-core
正如@VonC所指出的那样, color.ui自从git 1.8.4 color.ui默认为auto 。 不是太快发布;)
从Unix和Linux Stackexchange问题如何着色输出git? 和@Evgeny的回答:
git config --global color.ui auto
color.ui是一个元配置,包含git命令提供的所有各种color.*配置。 这在git help config中有深入的解释。
所以基本上比单独设置不同的color.*设置更容易和更有前途。
来自git config文档的深入解释:
color.ui :该变量确定控制每个命令系列的颜色使用的变量(如color.diff和color.grep的默认值。 随着更多命令学习配置为--color选项设置默认值,它的范围将扩大。 将其设置为always ,如果你想不用于机器消耗所有输出使用的颜色,以true或auto ,如果你想这样的输出使用的颜色,当写入到终端,或false或never如果你喜欢Git命令不使用颜色除非明确地使用其他配置或--color选项启用。
例如见http://www.arthurkoziel.com/2008/05/02/git-configuration/
有趣的部分是
彩色输出:
git config --global color.branch auto
git config --global color.diff auto
git config --global color.interactive auto
git config --global color.status auto
添加到你的.gitconfig文件的下一个代码:
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
链接地址: http://www.djcxy.com/p/15321.html
上一篇: How to color the Git console in Ubuntu?
下一篇: How do I change the full background color of the console window in C#?
