What Environmental Variable Sets Git Color.UI? What Environmental Variable Sets Git Color.UI? shell shell

What Environmental Variable Sets Git Color.UI?


Unfortunately, unlike some other settings, there is no environmental variable that allows you to override the color.ui config option.

The only way is to of course use the command line: git config --global color.ui true You can also edit the ~/.gitconfig file directly and add all of these color options. All of this info can be found here. Add colors to your ~/.gitconfig file:

[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

Highlight whitespace in diffs

[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'"

Change never to auto or always if you like.

This is not a documented feature, but has been around for quite a while and is covered by the git unit tests.