【问题标题】:What Environmental Variable Sets Git Color.UI?什么环境变量设置了 Git Color.UI?
【发布时间】:2013-05-16 14:19:21
【问题描述】:

是否有指定 color.ui 配置选项的 Git 环境变量?它似乎不在文档中,如果有的话。

【问题讨论】:

    标签: git shell version-control


    【解决方案1】:

    不幸的是,与其他一些设置不同,没有允许您覆盖 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
    

    【讨论】:

      【解决方案2】:

      GIT_CONFIG_PARAMETERS="'color.ui=never'"

      如果您愿意,请将 never 更改为 autoalways

      这不是一个文档化的特性,但已经存在了很长一段时间,并且被 git 单元测试所覆盖。

      【讨论】:

        猜你喜欢
        • 2016-03-14
        • 2017-11-14
        • 2016-01-23
        • 1970-01-01
        • 2015-11-13
        • 2018-12-29
        • 2018-07-13
        • 2019-06-22
        • 2016-11-09
        相关资源
        最近更新 更多