Home Explore Blog CI



git

2nd chunk of `Documentation/git-range-diff.adoc`
c34f0f0f1a0689f00e5026927ab65de6dd6a5d4f3125486e0000000100000f93
 range" when using the `<rev1>...<rev2>` format).

--right-only::
	Suppress commits that are missing from the second specified range
	(or the "right range" when using the `<rev1>...<rev2>` format).

--diff-merges=<format>::
	Instead of ignoring merge commits, generate diffs for them using the
	corresponding `--diff-merges=<format>` option of linkgit:git-log[1],
	and include them in the comparison.
+
Note: In the common case, the `remerge` mode will be the most natural one
to use, as it shows only the diff on top of what Git's merge machinery would
have produced. In other words, if a merge commit is the result of a
non-conflicting `git merge`, the `remerge` mode will represent it with an empty
diff.

--remerge-diff::
	Convenience option, equivalent to `--diff-merges=remerge`.

--[no-]notes[=<ref>]::
	This flag is passed to the `git log` program
	(see linkgit:git-log[1]) that generates the patches.

<range1> <range2>::
	Compare the commits specified by the two ranges, where
	`<range1>` is considered an older version of `<range2>`.

<rev1>...<rev2>::
	Equivalent to passing `<rev2>..<rev1>` and `<rev1>..<rev2>`.

<base> <rev1> <rev2>::
	Equivalent to passing `<base>..<rev1>` and `<base>..<rev2>`.
	Note that `<base>` does not need to be the exact branch point
	of the branches. Example: after rebasing a branch `my-topic`,
	`git range-diff my-topic@{u} my-topic@{1} my-topic` would
	show the differences introduced by the rebase.

`git range-diff` also accepts the regular diff options (see
linkgit:git-diff[1]), most notably the `--color=[<when>]` and
`--no-color` options. These options are used when generating the "diff
between patches", i.e. to compare the author, commit message and diff of
corresponding old/new commits. There is currently no means to tweak most of the
diff options passed to `git log` when generating those patches.

OUTPUT STABILITY
----------------

The output of the `range-diff` command is subject to change. It is
intended to be human-readable porcelain output, not something that can
be used across versions of Git to get a textually stable `range-diff`
(as opposed to something like the `--stable` option to
linkgit:git-patch-id[1]). There's also no equivalent of
linkgit:git-apply[1] for `range-diff`, the output is not intended to
be machine-readable.

This is particularly true when passing in diff options. Currently some
options like `--stat` can, as an emergent effect, produce output
that's quite useless in the context of `range-diff`. Future versions
of `range-diff` may learn to interpret such options in a manner
specific to `range-diff` (e.g. for `--stat` producing human-readable
output which summarizes how the diffstat changed).

CONFIGURATION
-------------
This command uses the `diff.color.*` and `pager.range-diff` settings
(the latter is on by default).
See linkgit:git-config[1].


EXAMPLES
--------

When a rebase required merge conflicts to be resolved, compare the changes
introduced by the rebase directly afterwards using:

------------
$ git range-diff @{u} @{1} @
------------


A typical output of `git range-diff` would look like this:

------------
-:  ------- > 1:  0ddba11 Prepare for the inevitable!
1:  c0debee = 2:  cab005e Add a helpful message at the start
2:  f00dbal ! 3:  decafe1 Describe a bug
    @@ -1,3 +1,3 @@
     Author: A U Thor <author@example.com>

    -TODO: Describe a bug
    +Describe a bug
    @@ -324,5 +324,6
      This is expected.

    -+What is unexpected is that it will also crash.
    ++Unexpectedly, it also crashes. This is a bug, and the jury is
    ++still out there how to fix it best. See ticket #314 for details.

      Contact
3:  bedead < -:  ------- TO-UNDO
------------

In this example, there are 3 old and 3 new commits, where the developer
removed the 3rd, added a new one before the first two, and modified the
commit message of the 2nd commit as well as its diff.

When the output goes to a terminal, it is color-coded by default, just
like regular `git diff`'s

Title: Git Range Diff Options and Output
Summary
The git range-diff command provides various options for comparing commit ranges, including suppressing commits, generating diffs for merge commits, and customizing the output, which is subject to change and intended for human-readable porcelain output.