【发布时间】:2013-05-16 14:19:21
【问题描述】:
是否有指定 color.ui 配置选项的 Git 环境变量?它似乎不在文档中,如果有的话。
【问题讨论】:
标签: git shell version-control
是否有指定 color.ui 配置选项的 Git 环境变量?它似乎不在文档中,如果有的话。
【问题讨论】:
标签: git shell version-control
不幸的是,与其他一些设置不同,没有允许您覆盖 color.ui 配置选项的环境变量。
唯一的方法当然是使用命令行:git config --global color.ui true 您也可以直接编辑~/.gitconfig 文件并添加所有这些颜色选项。所有这些信息都可以在here 找到。为您的~/.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
在差异中突出显示空白
[color]
ui = true
[color "diff"]
whitespace = red reverse
[core]
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
【讨论】:
GIT_CONFIG_PARAMETERS="'color.ui=never'"如果您愿意,请将 never 更改为 auto 或 always。
这不是一个文档化的特性,但已经存在了很长一段时间,并且被 git 单元测试所覆盖。
【讨论】: