Jonah
Jonah

Reputation: 10091

What Environmental Variable Sets Git Color.UI?

Is there a Git environmental variable that dictates the color.ui config option? It does not seem to be in the documentation, if there is one.

Upvotes: 3

Views: 742

Answers (2)

Doug Richardson
Doug Richardson

Reputation: 10811

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.

Upvotes: 4

fontno
fontno

Reputation: 6852

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

Upvotes: 3

Related Questions