Home Explore Blog CI



git

2nd chunk of `Documentation/config/diff.adoc`
febab02c743f0f3fb24b895ee0cee812826efdf7e31a4e790000000100000f87
 the graph part in `--stat` output. If set, applies
	to all commands generating `--stat` output except `format-patch`.

`diff.context`::
	Generate diffs with _<n>_ lines of context instead of the default
	of 3. This value is overridden by the `-U` option.

`diff.interHunkContext`::
	Show the context between diff hunks, up to the specified number
	of lines, thereby fusing the hunks that are close to each other.
	This value serves as the default for the `--inter-hunk-context`
	command line option.

`diff.external`::
	If this config variable is set, diff generation is not
	performed using the internal diff machinery, but using the
	given command.  Can be overridden with the `GIT_EXTERNAL_DIFF`
	environment variable.  The command is called with parameters
	as described under "git Diffs" in linkgit:git[1].  Note: if
	you want to use an external diff program only on a subset of
	your files, you might want to use linkgit:gitattributes[5] instead.

`diff.trustExitCode`::
	If this boolean value is set to `true` then the
	`diff.external` command is expected to return exit code
	0 if it considers the input files to be equal or 1 if it
	considers them to be different, like `diff`(1).
	If it is set to `false`, which is the default, then the command
	is expected to return exit code `0` regardless of equality.
	Any other exit code causes Git to report a fatal error.

`diff.ignoreSubmodules`::
	Sets the default value of `--ignore-submodules`. Note that this
	affects only `git diff` Porcelain, and not lower level `diff`
	commands such as `git diff-files`. `git checkout`
	and `git switch` also honor
	this setting when reporting uncommitted changes. Setting it to
	`all` disables the submodule summary normally shown by `git commit`
	and `git status` when `status.submoduleSummary` is set unless it is
	overridden by using the `--ignore-submodules` command-line option.
	The `git submodule` commands are not affected by this setting.
	By default this is set to untracked so that any untracked
	submodules are ignored.

`diff.mnemonicPrefix`::
	If set, `git diff` uses a prefix pair that is different from the
	standard `a/` and `b/` depending on what is being compared.  When
	this configuration is in effect, reverse diff output also swaps
	the order of the prefixes:
`git diff`;;
	compares the (i)ndex and the (w)ork tree;
`git diff HEAD`;;
	 compares a (c)ommit and the (w)ork tree;
`git diff --cached`;;
	compares a (c)ommit and the (i)ndex;
`git diff HEAD:<file1> <file2>`;;
	compares an (o)bject and a (w)ork tree entity;
`git diff --no-index <a> <b>`;;
	compares two non-git things _<a>_ and _<b>_.

`diff.noPrefix`::
	If set, `git diff` does not show any source or destination prefix.

`diff.srcPrefix`::
	If set, `git diff` uses this source prefix. Defaults to `a/`.

`diff.dstPrefix`::
	If set, `git diff` uses this destination prefix. Defaults to `b/`.

`diff.relative`::
	If set to `true`, `git diff` does not show changes outside of the directory
	and show pathnames relative to the current directory.

`diff.orderFile`::
	File indicating how to order files within a diff.
ifdef::git-diff[]
	See the `-O` option for details.
endif::git-diff[]
ifndef::git-diff[]
	See the `-O` option to linkgit:git-diff[1] for details.
endif::git-diff[]
	If `diff.orderFile` is a relative pathname, it is treated as
	relative to the top of the working tree.

`diff.renameLimit`::
	The number of files to consider in the exhaustive portion of
	copy/rename detection; equivalent to the `git diff` option
	`-l`.  If not set, the default value is currently 1000.  This
	setting has no effect if rename detection is turned off.

`diff.renames`::
	Whether and how Git detects renames.  If set to `false`,
	rename detection is disabled. If set to `true`, basic rename
	detection is enabled.  If set to `copies` or `copy`, Git will
	detect copies, as well.  Defaults to `true`.  Note that this
	affects only `git diff` Porcelain like linkgit:git-diff[1] and
	linkgit:git-log[1],

Title: Git Diff Configuration Options
Summary
This section describes various configuration options for customizing the behavior of Git's diff commands, including context lines, external diff programs, submodule handling, prefix settings, and rename detection settings.