Skip to content

Commit 5f8937d

Browse files
committed
Merge branch 'mg/diff-uiconfig-doc' into maint
* mg/diff-uiconfig-doc: config.txt,diff-options.txt: porcelain vs. plumbing for color.diff
2 parents b73f3d2 + 6999c54 commit 5f8937d

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

Documentation/config.txt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,16 @@ second is the background. The position of the attribute, if any,
706706
doesn't matter.
707707

708708
color.diff::
709-
When set to `always`, always use colors in patch.
710-
When false (or `never`), never. When set to `true` or `auto`, use
711-
colors only when the output is to the terminal. Defaults to false.
709+
Whether to use ANSI escape sequences to add color to patches.
710+
If this is set to `always`, linkgit:git-diff[1],
711+
linkgit:git-log[1], and linkgit:git-show[1] will use color
712+
for all patches. If it is set to `true` or `auto`, those
713+
commands will only use color when output is to the terminal.
714+
Defaults to false.
715+
+
716+
This does not affect linkgit:git-format-patch[1] nor the
717+
'git-diff-{asterisk}' plumbing commands. Can be overridden on the
718+
command line with the `--color[=<when>]` option.
712719

713720
color.diff.<slot>::
714721
Use customized color for diff colorization. `<slot>` specifies
@@ -794,11 +801,15 @@ color.status.<slot>::
794801
color.branch.<slot>.
795802

796803
color.ui::
797-
When set to `always`, always use colors in all git commands which
798-
are capable of colored output. When false (or `never`), never. When
799-
set to `true` or `auto`, use colors only when the output is to the
800-
terminal. When more specific variables of color.* are set, they always
801-
take precedence over this setting. Defaults to false.
804+
This variable determines the default value for variables such
805+
as `color.diff` and `color.grep` that control the use of color
806+
per command family. Its scope will expand as more commands learn
807+
configuration to set a default for the `--color` option. Set it
808+
to `always` if you want all output not intended for machine
809+
consumption to use color, to `true` or `auto` if you want such
810+
output to use color when written to the terminal, or to `false` or
811+
`never` if you prefer git commands not to use color unless enabled
812+
explicitly with some other configuration or the `--color` option.
802813

803814
commit.status::
804815
A boolean to enable/disable inclusion of status information in the

Documentation/diff-options.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,19 @@ any of those replacements occurred.
124124

125125
--color[=<when>]::
126126
Show colored diff.
127-
The value must be always (the default), never, or auto.
127+
The value must be `always` (the default for `<when>`), `never`, or `auto`.
128+
The default value is `never`.
129+
ifdef::git-diff[]
130+
It can be changed by the `color.ui` and `color.diff`
131+
configuration settings.
132+
endif::git-diff[]
128133

129134
--no-color::
130-
Turn off colored diff, even when the configuration file
131-
gives the default to color output.
132-
Same as `--color=never`.
135+
Turn off colored diff.
136+
ifdef::git-diff[]
137+
This can be used to override configuration settings.
138+
endif::git-diff[]
139+
It is the same as `--color=never`.
133140

134141
--word-diff[=<mode>]::
135142
Show a word diff, using the <mode> to delimit changed words.

0 commit comments

Comments
 (0)