Skip to contentSkip to conversation

Potentially misleading color.* defaults explanation in git-config(1)

DISCUSSION Anatoly Borodin 2 participants 3 messages Sep 16, 2016 – Sep 17, 2016

lore
Share & tools
lore
#0 lore raw

Hi All!

git-config(1) says:

color.branch
A boolean to enable/disable color in the output of git-branch(1). May be set to always, false (or never) or auto (or true), in which case colors are used only when the output is to a terminal. Defaults to false.

If the value false is the default, and neither color.branch nor color.ui is set in any config file, one can expect that

(1) git branch

and

(2) git config color.branch false ; git branch

produce the same result. But only (2) produces colorless output, (1) uses colors (that probably depend on the default value of color.ui).

The same story with color.diff and git-show, color.grep, etc.

Is it me being a non-native English speaker, or does this part really need to be rewritten?

PS git version 2.9.3

Signature · 2 lines
Mit freundlichen Grüßen,
Anatoly Borodin
#1 lore raw
Quoted 8 lines · Anatoly Borodin

Hi All!

git-config(1) says:

color.branch
A boolean to enable/disable color in the output of git-branch(1). May be set to always, false (or never) or auto (or true), in which case colors are used only when the output is to a terminal.

So far, so good.

Quoted 1 line

Defaults to false.

The truth is: Defaults to following color.ui, which used to default to false but now defaults to auto.

My bad, I forgot to update these parts of the docs when changing the default for color.ui (a while back already). Patch follows.

Quoted 1 line

(2) git config color.branch false ; git branch

Unrelated from the question, but you could write

git -c color.branch=false git branch

to set a configuration value just for one command.

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#2 lore raw

Hi!

Quoted 2 lines · Matthieu Moy

My bad, I forgot to update these parts of the docs when changing the default for color.ui (a while back already). Patch follows.

Thanks for the patch!

Quoted 1 line

git -c color.branch=false git branch

Oh, that's a nice one! I don't get a chance to use those between-git-and-command options often.

Merci!

Signature · 2 lines
Mit freundlichen Grüßen,
Anatoly Borodin