Home Explore Blog CI



git

11th chunk of `Documentation/diff-options.adoc`
99165b8d5f00a788065cc2ac70835b432fe5d29e457ea0b70000000100000fa0

`--ignore-all-space`::
	Ignore whitespace when comparing lines.  This ignores
	differences even if one line has whitespace where the other
	line has none.

`--ignore-blank-lines`::
	Ignore changes whose lines are all blank.


`-I<regex>`::
`--ignore-matching-lines=<regex>`::
	Ignore changes whose all lines match _<regex>_.  This option may
	be specified more than once.

`--inter-hunk-context=<number>`::
	Show the context between diff hunks, up to the specified _<number>_
	of lines, thereby fusing hunks that are close to each other.
	Defaults to `diff.interHunkContext` or 0 if the config option
	is unset.

`-W`::
`--function-context`::
	Show whole function as context lines for each change.
	The function names are determined in the same way as
	`git diff` works out patch hunk headers (see "Defining a
	custom hunk-header" in linkgit:gitattributes[5]).

ifndef::git-format-patch[]
ifndef::git-log[]
`--exit-code`::
	Make the program exit with codes similar to `diff`(1).
	That is, it exits with 1 if there were differences and
	0 means no differences.

`--quiet`::
	Disable all output of the program. Implies `--exit-code`.
	Disables execution of external diff helpers whose exit code
	is not trusted, i.e. their respective configuration option
	`diff.trustExitCode` or ++diff.++__<driver>__++.trustExitCode++ or
	environment variable `GIT_EXTERNAL_DIFF_TRUST_EXIT_CODE` is
	false.
endif::git-log[]
endif::git-format-patch[]

`--ext-diff`::
	Allow an external diff helper to be executed. If you set an
	external diff driver with linkgit:gitattributes[5], you need
	to use this option with linkgit:git-log[1] and friends.

`--no-ext-diff`::
	Disallow external diff drivers.

`--textconv`::
`--no-textconv`::
	Allow (or disallow) external text conversion filters to be run
	when comparing binary files. See linkgit:gitattributes[5] for
	details. Because textconv filters are typically a one-way
	conversion, the resulting diff is suitable for human
	consumption, but cannot be applied. For this reason, textconv
	filters are enabled by default only for linkgit:git-diff[1] and
	linkgit:git-log[1], but not for linkgit:git-format-patch[1] or
	diff plumbing commands.


`--ignore-submodules[=(none|untracked|dirty|all)]`::
	Ignore changes to submodules in the diff generation. `all` is the default.
	Using `none` will consider the submodule modified when it either contains
	untracked or modified files or its `HEAD` differs from the commit recorded
	in the superproject and can be used to override any settings of the
	`ignore` option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
	`untracked` is used submodules are not considered dirty when they only
	contain untracked content (but they are still scanned for modified
	content). Using `dirty` ignores all changes to the work tree of submodules,
	only changes to the commits stored in the superproject are shown (this was
	the behavior until 1.7.0). Using `all` hides all changes to submodules.

`--src-prefix=<prefix>`::
	Show the given source _<prefix>_ instead of "a/".

`--dst-prefix=<prefix>`::
	Show the given destination _<prefix>_ instead of "b/".

`--no-prefix`::
	Do not show any source or destination prefix.

`--default-prefix`::
	Use the default source and destination prefixes ("a/" and "b/").
	This overrides configuration variables such as `diff.noprefix`,
	`diff.srcPrefix`, `diff.dstPrefix`, and `diff.mnemonicPrefix`
	(see linkgit:git-config[1]).

`--line-prefix=<prefix>`::
	Prepend an additional _<prefix>_ to every line of output.

`--ita-invisible-in-index`::
	By default entries added by `git add -N` appear as an existing
	empty file in `git diff` and a new file in `git diff --cached`.
	This option makes the entry appear as a new file in `git diff`
	and non-existent in `git diff --cached`. This option could be
	reverted with `--ita-visible-in-index`. Both options are
	experimental and could be removed in future.

For more detailed explanation on these common options, see also
linkgit:gitdiffcore[7].

Title: Git Diff Options for Customization and Filtering
Summary
This section describes various Git diff options for customizing the output, including ignoring whitespace, blank lines, and specific patterns, as well as options for controlling context lines, external diff helpers, text conversion filters, and submodule changes, allowing users to tailor the diff output to their needs and preferences.