Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 806
Jonah Avatar asked Jul 12 '26 10:07

Jonah


2 Answers

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.

like image 149
Doug Richardson Avatar answered Jul 15 '26 04:07

Doug Richardson


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
like image 20
fontno Avatar answered Jul 15 '26 04:07

fontno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!