Home Explore Blog CI



git

7th chunk of `Documentation/diff-options.adoc`
c46913abca6910e1207c62be1891c8bf236b8185bf0ff8180000000100000fa0
 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`, output a binary diff that
	can be applied with `git-apply`.
ifndef::git-format-patch[]
	Implies `--patch`.
endif::git-format-patch[]

`--abbrev[=<n>]`::
	Instead of showing the full 40-byte hexadecimal object
	name in diff-raw format output and diff-tree header
	lines, show the shortest prefix that is at least _<n>_
	hexdigits long that uniquely refers the object.
	In diff-patch output format, `--full-index` takes higher
	precedence, i.e. if `--full-index` is specified, full blob
	names will be shown regardless of `--abbrev`.
	Non default number of digits can be specified with `--abbrev=<n>`.

`-B[<n>][/<m>]`::
`--break-rewrites[=[<n>][/<m>]]`::
	Break complete rewrite changes into pairs of delete and
	create. This serves two purposes:
+
It affects the way a change that amounts to a total rewrite of a file
not as a series of deletion and insertion mixed together with a very
few lines that happen to match textually as the context, but as a
single deletion of everything old followed by a single insertion of
everything new, and the number _<m>_ controls this aspect of the `-B`
option (defaults to 60%). `-B/70%` specifies that less than 30% of the
original should remain in the result for Git to consider it a total
rewrite (i.e. otherwise the resulting patch will be a series of
deletion and insertion mixed together with context lines).
+
When used with `-M`, a totally-rewritten file is also considered as the
source of a rename (usually `-M` only considers a file that disappeared
as the source of a rename), and the number _<n>_ controls this aspect of
the `-B` option (defaults to 50%). `-B20%` specifies that a change with
addition and deletion compared to 20% or more of the file's size are
eligible for being picked up as a possible source of a rename to
another file.

`-M[<n>]`::
`--find-renames[=<n>]`::
ifndef::git-log[]
	Detect renames.
endif::git-log[]
ifdef::git-log[]
	If generating diffs, detect and report renames for each commit.
	For following files across renames while traversing history, see
	`--follow`.
endif::git-log[]
	If _<n>_ is specified, it is a threshold on the similarity
	index (i.e. amount of addition/deletions compared to the
	file's size). For example, `-M90%` means Git should consider a
	delete/add pair to be a rename if more than 90% of the file
	hasn't changed.  Without a `%` sign, the number is to be read as
	a fraction, with a decimal point before it.  I.e., `-M5` becomes
	0.5, and is thus the same as `-M50%`.  Similarly, `-M05` is
	the same as `-M5%`.  To limit detection to exact renames, use
	`-M100%`.  The default similarity index is 50%.

`-C[<n>]`::
`--find-copies[=<n>]`::
	Detect copies as well as renames.  See also `--find-copies-harder`.
	If _<n>_ is specified, it has the same meaning as for `-M<n>`.

`--find-copies-harder`::
	For performance reasons, by default, `-C` option finds copies only
	if the original file of the copy was modified in the same
	changeset.  This flag makes the command
	inspect unmodified files

Title: Advanced Git Diff Options for Formatting and Rename Detection
Summary
This section describes advanced options for customizing the display of diff information in Git, including options for highlighting whitespace errors, showing full index lines, and detecting renames and copies, such as `--ws-error-highlight`, `--full-index`, `--break-rewrites`, `--find-renames`, and `--find-copies`, which can be used to fine-tune the diff output and identify changes in files.