Home Explore Blog CI



git

2nd chunk of `Documentation/diff-options.adoc`
043fda12e9cb995dcb338a0525ca390d7f27d7fdd370d4880000000100000fa5
 temporary tree
	object--potentially containing files with conflict markers
	and such.  A diff is then shown between that temporary tree
	and the actual merge commit.
+
The output emitted when this option is used is subject to change, and
so is its interaction with other options (unless explicitly
documented).
--

--combined-all-paths::
	Cause combined diffs (used for merge commits) to
	list the name of the file from all parents.  It thus only has
	effect when `--diff-merges=[dense-]combined` is in use, and
	is likely only useful if filename changes are detected (i.e.
	when either rename or copy detection have been requested).
endif::git-log[]

`-U<n>`::
`--unified=<n>`::
	Generate diffs with _<n>_ lines of context instead of
	the usual three.
ifndef::git-format-patch[]
	Implies `--patch`.
endif::git-format-patch[]

`--output=<file>`::
	Output to a specific file instead of stdout.

`--output-indicator-new=<char>`::
`--output-indicator-old=<char>`::
`--output-indicator-context=<char>`::
	Specify the character used to indicate new, old or context
	lines in the generated patch. Normally they are `+`, `-` and
	' ' respectively.

ifndef::git-format-patch[]
`--raw`::
ifndef::git-log[]
	Generate the diff in raw format.
ifdef::git-diff-core[]
	This is the default.
endif::git-diff-core[]
endif::git-log[]
ifdef::git-log[]
	For each commit, show a summary of changes using the raw diff
	format. See the "RAW OUTPUT FORMAT" section of
	linkgit:git-diff[1]. This is different from showing the log
	itself in raw format, which you can achieve with
	`--format=raw`.
endif::git-log[]
endif::git-format-patch[]

ifndef::git-format-patch[]
`--patch-with-raw`::
	Synonym for `-p --raw`.
endif::git-format-patch[]

ifdef::git-log[]
`-t`::
	Show the tree objects in the diff output.
endif::git-log[]

`--indent-heuristic`::
	Enable the heuristic that shifts diff hunk boundaries to make patches
	easier to read. This is the default.

`--no-indent-heuristic`::
	Disable the indent heuristic.

`--minimal`::
	Spend extra time to make sure the smallest possible
	diff is produced.

`--patience`::
	Generate a diff using the "patience diff" algorithm.

`--histogram`::
	Generate a diff using the "histogram diff" algorithm.

`--anchored=<text>`::
	Generate a diff using the "anchored diff" algorithm.
+
This option may be specified more than once.
+
If a line exists in both the source and destination, exists only once,
and starts with _<text>_, this algorithm attempts to prevent it from
appearing as a deletion or addition in the output. It uses the "patience
diff" algorithm internally.

`--diff-algorithm=(patience|minimal|histogram|myers)`::
	Choose a diff algorithm. The variants are as follows:
+
--
   `default`;;
   `myers`;;
	The basic greedy diff algorithm. Currently, this is the default.
   `minimal`;;
	Spend extra time to make sure the smallest possible diff is
	produced.
   `patience`;;
	Use "patience diff" algorithm when generating patches.
   `histogram`;;
	This algorithm extends the patience algorithm to "support
	low-occurrence common elements".
--
+
For instance, if you configured the `diff.algorithm` variable to a
non-default value and want to use the default one, then you
have to use `--diff-algorithm=default` option.

`--stat[=<width>[,<name-width>[,<count>]]]`::
	Generate a diffstat. By default, as much space as necessary
	will be used for the filename part, and the rest for the graph
	part. Maximum width defaults to terminal width, or 80 columns
	if not connected to a terminal, and can be overridden by
	_<width>_. The width of the filename part can be limited by
	giving another width _<name-width>_ after a comma or by setting
	`diff.statNameWidth=<name-width>`. The width of the graph part can be
	limited by using `--stat-graph-width=<graph-width>` or by setting
	`diff.statGraphWidth=<graph-width>`. Using `--stat` or
	`--stat-graph-width` affects all commands generating a stat graph,
	while setting `diff.statNameWidth` or `diff.statGraphWidth`
	does not affect

Title: Advanced Git Diff Options
Summary
This section describes additional options for customizing the output of Git diff commands, including options for formatting, filtering, and analyzing diffs, such as generating diffs with custom context, outputting to files, and using different diff algorithms, as well as options for generating diff statistics and customizing the display of diff output.