summaryrefslogtreecommitdiff
path: root/Documentation/diff-options.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/diff-options.txt')
-rw-r--r--Documentation/diff-options.txt188
1 files changed, 156 insertions, 32 deletions
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 7987d72..aaaff0d 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -22,23 +22,109 @@ ifndef::git-format-patch[]
-p::
-u::
--patch::
- Generate patch (see section on generating patches).
+ Generate patch (see <<generate_patch_text_with_p>>).
ifdef::git-diff[]
This is the default.
endif::git-diff[]
-s::
--no-patch::
- Suppress diff output. Useful for commands like `git show` that
- show the patch by default, or to cancel the effect of `--patch`.
+ Suppress all output from the diff machinery. Useful for
+ commands like `git show` that show the patch by default to
+ squelch their output, or to cancel the effect of options like
+ `--patch`, `--stat` earlier on the command line in an alias.
+
endif::git-format-patch[]
+ifdef::git-log[]
+-m::
+ Show diffs for merge commits in the default format. This is
+ similar to '--diff-merges=on', except `-m` will
+ produce no output unless `-p` is given as well.
+
+-c::
+ Produce combined diff output for merge commits.
+ Shortcut for '--diff-merges=combined -p'.
+
+--cc::
+ Produce dense combined diff output for merge commits.
+ Shortcut for '--diff-merges=dense-combined -p'.
+
+--dd::
+ Produce diff with respect to first parent for both merge and
+ regular commits.
+ Shortcut for '--diff-merges=first-parent -p'.
+
+--remerge-diff::
+ Produce remerge-diff output for merge commits.
+ Shortcut for '--diff-merges=remerge -p'.
+
+--no-diff-merges::
+ Synonym for '--diff-merges=off'.
+
+--diff-merges=<format>::
+ Specify diff format to be used for merge commits. Default is
+ {diff-merges-default} unless `--first-parent` is in use, in
+ which case `first-parent` is the default.
++
+The following formats are supported:
++
+--
+off, none::
+ Disable output of diffs for merge commits. Useful to override
+ implied value.
++
+on, m::
+ Make diff output for merge commits to be shown in the default
+ format. The default format can be changed using
+ `log.diffMerges` configuration variable, whose default value
+ is `separate`.
++
+first-parent, 1::
+ Show full diff with respect to first parent. This is the same
+ format as `--patch` produces for non-merge commits.
++
+separate::
+ Show full diff with respect to each of parents.
+ Separate log entry and diff is generated for each parent.
++
+combined, c::
+ Show differences from each of the parents to the merge
+ result simultaneously instead of showing pairwise diff between
+ a parent and the result one at a time. Furthermore, it lists
+ only files which were modified from all parents.
++
+dense-combined, cc::
+ Further compress output produced by `--diff-merges=combined`
+ by omitting uninteresting hunks whose contents in the parents
+ have only two variants and the merge result picks one of them
+ without modification.
++
+remerge, r::
+ Remerge two-parent merge commits to create a 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::
+ This flag causes 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. Implies `--patch`.
+ the usual three.
ifndef::git-format-patch[]
- Implies `-p`.
+ Implies `--patch`.
endif::git-format-patch[]
--output=<file>::
@@ -73,6 +159,11 @@ ifndef::git-format-patch[]
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.
@@ -126,14 +217,15 @@ have to use `--diff-algorithm=default` option.
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. The width
- of the graph part can be limited by using
- `--stat-graph-width=<width>` (affects all commands generating
- a stat graph) or by setting `diff.statGraphWidth=<width>`
- (does not affect `git format-patch`).
- By giving a third parameter `<count>`, you can limit the
- output to the first `<count>` lines, followed by `...` if
- there are more.
+ giving another width `<name-width>` after a comma or by setting
+ `diff.statNameWidth=<width>`. The width of the graph part can be
+ limited by using `--stat-graph-width=<width>` or by setting
+ `diff.statGraphWidth=<width>`. Using `--stat` or
+ `--stat-graph-width` affects all commands generating a stat graph,
+ while setting `diff.statNameWidth` or `diff.statGraphWidth`
+ does not affect `git format-patch`.
+ By giving a third parameter `<count>`, you can limit the output to
+ the first `<count>` lines, followed by `...` if there are more.
+
These parameters can also be set individually with `--stat-width=<width>`,
`--stat-name-width=<name-width>` and `--stat-count=<count>`.
@@ -207,7 +299,7 @@ and accumulating child directory counts in the parent directories:
Synonym for --dirstat=cumulative
--dirstat-by-file[=<param1,param2>...]::
- Synonym for --dirstat=files,param1,param2...
+ Synonym for --dirstat=files,<param1>,<param2>...
--summary::
Output a condensed summary of extended header information
@@ -222,7 +314,7 @@ ifndef::git-format-patch[]
-z::
ifdef::git-log[]
- Separate the commits with NULs instead of with new newlines.
+ Separate the commits with NULs instead of newlines.
+
Also, when `--raw` or `--numstat` has been given, do not munge
pathnames and use NULs as output field terminators.
@@ -237,11 +329,14 @@ explained for the configuration variable `core.quotePath` (see
linkgit:git-config[1]).
--name-only::
- Show only names of changed files.
+ Show only names of changed files. The file names are often encoded in UTF-8.
+ For more information see the discussion about encoding in the linkgit:git-log[1]
+ manual page.
--name-status::
Show only names and status of changed files. See the description
of the `--diff-filter` option on what the status letters mean.
+ Just like `--name-only` the file names are often encoded in UTF-8.
--submodule[=<format>]::
Specify how differences in submodules are shown. When specifying
@@ -436,15 +531,20 @@ endif::git-format-patch[]
--binary::
In addition to `--full-index`, output a binary diff that
- can be applied with `git-apply`. Implies `--patch`.
+ 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 only a partial prefix. This is
- independent of the `--full-index` option above, which controls
- the diff-patch output format. Non default number of
- digits can be specified with `--abbrev=<n>`.
+ 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>]]::
@@ -517,11 +617,17 @@ When used together with `-B`, omit also the preimage in the deletion part
of a delete/create pair.
-l<num>::
- The `-M` and `-C` options require O(n^2) processing time where n
- is the number of potential rename/copy targets. This
- option prevents rename/copy detection from running if
- the number of rename/copy targets exceeds the specified
- number.
+ The `-M` and `-C` options involve some preliminary steps that
+ can detect subsets of renames/copies cheaply, followed by an
+ exhaustive fallback portion that compares all remaining
+ unpaired destinations to all relevant sources. (For renames,
+ only remaining unpaired sources are relevant; for copies, all
+ original sources are relevant.) For N sources and
+ destinations, this exhaustive check is O(N^2). This option
+ prevents the exhaustive portion of rename/copy detection from
+ running if the number of source/destination files involved
+ exceeds the specified number. Defaults to diff.renameLimit.
+ Note that a value of 0 is treated as unlimited.
ifndef::git-format-patch[]
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]::
@@ -539,11 +645,8 @@ ifndef::git-format-patch[]
Also, these upper-case letters can be downcased to exclude. E.g.
`--diff-filter=ad` excludes added and deleted paths.
+
-Note that not all diffs can feature all types. For instance, diffs
-from the index to the working tree can never have Added entries
-(because the set of paths included in the diff is limited by what is in
-the index). Similarly, copied and renamed entries cannot appear if
-detection for those types is disabled.
+Note that not all diffs can feature all types. For instance, copied and
+renamed entries cannot appear if detection for those types is disabled.
-S<string>::
Look for differences that change the number of occurrences of
@@ -639,6 +742,14 @@ matches a pattern if removing any number of the final pathname
components matches the pattern. For example, the pattern "`foo*bar`"
matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".
+--skip-to=<file>::
+--rotate-to=<file>::
+ Discard the files before the named <file> from the output
+ (i.e. 'skip to'), or move them to the end of the output
+ (i.e. 'rotate to'). These options were invented primarily for the use
+ of the `git difftool` command, and may not be very useful
+ otherwise.
+
ifndef::git-format-patch[]
-R::
Swap two inputs; that is, show differences from index or
@@ -681,6 +792,11 @@ endif::git-format-patch[]
--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=<lines>::
Show the context between diff hunks, up to the specified number
of lines, thereby fusing hunks that are close to each other.
@@ -689,7 +805,10 @@ endif::git-format-patch[]
-W::
--function-context::
- Show whole surrounding functions of changes.
+ 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[]
@@ -744,6 +863,11 @@ endif::git-format-patch[]
--no-prefix::
Do not show any source or destination prefix.
+--default-prefix::
+ Use the default source and destination prefixes ("a/" and "b/").
+ This is usually the default already, but may be used to override
+ config such as `diff.noprefix`.
+
--line-prefix=<prefix>::
Prepend an additional prefix to every line of output.