Home Explore Blog CI



git

5th chunk of `Documentation/diff-options.adoc`
214168e81d85ce28740adf787296c6ec66433e26dded5f070000000100000fa9
	is specified, the `diff` format is used.  This format shows an
	inline diff of the changes in the submodule contents between the
	commit range.  Defaults to `diff.submodule` or the `short` format
	if the config option is unset.

`--color[=<when>]`::
	Show colored diff.
	`--color` (i.e. without `=<when>`) is the same as `--color=always`.
	_<when>_ can be one of `always`, `never`, or `auto`.
ifdef::git-diff[]
	It can be changed by the `color.ui` and `color.diff`
	configuration settings.
endif::git-diff[]

`--no-color`::
	Turn off colored diff.
ifdef::git-diff[]
	This can be used to override configuration settings.
endif::git-diff[]
	It is the same as `--color=never`.

`--color-moved[=<mode>]`::
	Moved lines of code are colored differently.
ifdef::git-diff[]
	It can be changed by the `diff.colorMoved` configuration setting.
endif::git-diff[]
	The _<mode>_ defaults to `no` if the option is not given
	and to `zebra` if the option with no mode is given.
	The mode must be one of:
+
--
`no`::
	Moved lines are not highlighted.
`default`::
	Is a synonym for `zebra`. This may change to a more sensible mode
	in the future.
`plain`::
	Any line that is added in one location and was removed
	in another location will be colored with `color.diff.newMoved`.
	Similarly `color.diff.oldMoved` will be used for removed lines
	that are added somewhere else in the diff. This mode picks up any
	moved line, but it is not very useful in a review to determine
	if a block of code was moved without permutation.
`blocks`::
	Blocks of moved text of at least 20 alphanumeric characters
	are detected greedily. The detected blocks are
	painted using either the `color.diff.(old|new)Moved` color.
	Adjacent blocks cannot be told apart.
`zebra`::
	Blocks of moved text are detected as in `blocks` mode. The blocks
	are painted using either the `color.diff.(old|new)Moved` color or
	`color.diff.(old|new)MovedAlternative`. The change between
	the two colors indicates that a new block was detected.
`dimmed-zebra`::
	Similar to `zebra`, but additional dimming of uninteresting parts
	of moved code is performed. The bordering lines of two adjacent
	blocks are considered interesting, the rest is uninteresting.
	`dimmed_zebra` is a deprecated synonym.
--

`--no-color-moved`::
	Turn off move detection. This can be used to override configuration
	settings. It is the same as `--color-moved=no`.

`--color-moved-ws=<mode>,...`::
	This configures how whitespace is ignored when performing the
	move detection for `--color-moved`.
ifdef::git-diff[]
	It can be set by the `diff.colorMovedWS` configuration setting.
endif::git-diff[]
	These modes can be given as a comma separated list:
+
--
`no`::
	Do not ignore whitespace when performing move detection.
`ignore-space-at-eol`::
	Ignore changes in whitespace at EOL.
`ignore-space-change`::
	Ignore changes in amount of whitespace.  This ignores whitespace
	at line end, and considers all other sequences of one or
	more whitespace characters to be equivalent.
`ignore-all-space`::
	Ignore whitespace when comparing lines. This ignores differences
	even if one line has whitespace where the other line has none.
`allow-indentation-change`::
	Initially ignore any whitespace in the move detection, then
	group the moved code blocks only into a block if the change in
	whitespace is the same per line. This is incompatible with the
	other modes.
--

`--no-color-moved-ws`::
	Do not ignore whitespace when performing move detection. This can be
	used to override configuration settings. It is the same as
	`--color-moved-ws=no`.

`--word-diff[=<mode>]`::
	By default, words are delimited by whitespace; see
	`--word-diff-regex` below.  The _<mode>_ defaults to `plain`, and
	must be one of:
+
--
`color`::
	Highlight changed words using only colors.  Implies `--color`.
`plain`::
	Show words as ++[-removed-]++ and ++{+added+}++.  Makes no
	attempts to escape the delimiters if they appear in the input,
	so the output may be ambiguous.
`porcelain`::
	Use a special line-based

Title: Git Diff Color and Move Detection Options
Summary
This section describes options for customizing the display of diff information in Git, including options for showing colored diff, move detection, and whitespace ignoring, as well as options for configuring the display of word-level differences.