Home Explore Blog CI



git

6th chunk of `Documentation/diff-options.adoc`
2a7cbeca38259f0da74100c5be500541521a133606f3e00d0000000100000faf

`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 format intended for script
	consumption.  Added/removed/unchanged runs are printed in the
	usual unified diff format, starting with a `+`/`-`/` `
	character at the beginning of the line and extending to the
	end of the line.  Newlines in the input are represented by a
	tilde `~` on a line of its own.
`none`::
	Disable word diff again.
--
+
Note that despite the name of the first mode, color is used to
highlight the changed parts in all modes if enabled.

`--word-diff-regex=<regex>`::
	Use _<regex>_ to decide what a word is, instead of considering
	runs of non-whitespace to be a word.  Also implies
	`--word-diff` unless it was already enabled.
+
Every non-overlapping match of the
_<regex>_ is considered a word.  Anything between these matches is
considered whitespace and ignored(!) for the purposes of finding
differences.  You may want to append `|[^[:space:]]` to your regular
expression to make sure that it matches all non-whitespace characters.
A match that contains a newline is silently truncated(!) at the
newline.
+
For example, `--word-diff-regex=.` will treat each character as a word
and, correspondingly, show differences character by character.
+
The regex can also be set via a diff driver or configuration option, see
linkgit:gitattributes[5] or linkgit:git-config[1].  Giving it explicitly
overrides any diff driver or configuration setting.  Diff drivers
override configuration settings.

`--color-words[=<regex>]`::
	Equivalent to `--word-diff=color` plus (if a regex was
	specified) `--word-diff-regex=<regex>`.
endif::git-format-patch[]

`--no-renames`::
	Turn off rename detection, even when the configuration
	file gives the default to do so.

`--[no-]rename-empty`::
	Whether to use empty blobs as rename source.

ifndef::git-format-patch[]
`--check`::
	Warn if changes introduce conflict markers or whitespace errors.
	What are considered whitespace errors is controlled by `core.whitespace`
	configuration.  By default, trailing whitespaces (including
	lines that consist solely of whitespaces) and a space character
	that is immediately followed by a tab character inside the
	initial indent of the line are considered whitespace errors.
	Exits with non-zero status if problems are found. Not compatible
	with `--exit-code`.

`--ws-error-highlight=<kind>`::
	Highlight whitespace errors in the `context`, `old` or `new`
	lines of the diff.  Multiple values are separated by comma,
	`none` resets previous values, `default` reset the list to
	`new` and `all` is a shorthand for `old,new,context`.  When
	this option is not given, and the configuration variable
	`diff.wsErrorHighlight` is not set, only whitespace errors in
	`new` lines are highlighted. The whitespace errors are colored
	with `color.diff.whitespace`.

endif::git-format-patch[]

`--full-index`::
	Instead of the first handful of characters, show the full
	pre- and post-image blob object names on the "index"
	line when generating patch format output.

`--binary`::
	In addition to `--full-index`,

Title: Git Diff Options for Word-Level Comparison and Rename Detection
Summary
This section describes options for customizing the display of diff information in Git, including options for word-level comparison, such as `--word-diff` and `--word-diff-regex`, as well as options for controlling rename detection, such as `--no-renames` and `--rename-empty`, and other options like `--check` and `--ws-error-highlight` for error checking and highlighting.