English ▾ Topics ▾ Latest version ▾ git-range-diff last updated in 2.55.0

NAME

git-range-diff - Compare two commit ranges (e.g. two versions of a branch)

SYNOPSIS

git range-diff [--color=[<when>]] [--no-color] [<diff-options>]
	[--no-dual-color] [--creation-factor=<factor>]
	[--left-only | --right-only] [--diff-merges=<format>]
	[--remerge-diff] [--no-notes | --notes[=<ref>]]
	( <range1> <range2> | <rev1>...<rev2> | <base> <rev1> <rev2> )
	[[--] <path>…​]

DESCRIPTION

This command shows the differences between two versions of a patch series, or more generally, two commit ranges (ignoring merge commits).

In the presence of <path> arguments, these commit ranges are limited accordingly.

To that end, it first finds pairs of commits from both commit ranges that correspond with each other. Two commits are said to correspond when the diff between their patches (i.e. the author information, the commit message and the commit diff) is reasonably small compared to the patches' size. See Algorithm below for details.

Finally, the list of matching commits is shown in the order of the second commit range, with unmatched commits being inserted just after all of their ancestors have been shown.

There are three ways to specify the commit ranges:

  • <range1> <range2>: Either commit range can be of the form <base>..<rev>, <rev>^! or <rev>^-<n>. See SPECIFYING RANGES in gitrevisions[7] for more details.

  • <rev1>...<rev2>. This is equivalent to <rev2>..<rev1> <rev1>..<rev2>.

  • <base> <rev1> <rev2>: This is equivalent to <base>..<rev1> <base>..<rev2>.

OPTIONS

--no-dual-color

When the commit diffs differ, git range-diff recreates the original diffs' coloring, and adds outer -/+ diff markers with the background being red/green to make it easier to see e.g. when there was a change in what exact lines were added.

Additionally, the commit diff lines that are only present in the first commit range are shown "dimmed" (this can be overridden using the color.diff.<slot> config setting where <slot> is one of contextDimmed, oldDimmed and newDimmed), and the commit diff lines that are only present in the second commit range are shown in bold (which can be overridden using the config settings color.diff.<slot> with <slot> being one of contextBold, oldBold or newBold).

This is known to range-diff as "dual coloring". Use --no-dual-color to revert to color all lines according to the outer diff markers (and completely ignore the inner diff when it comes to color).

--creation-factor=<percent>

Set the creation/deletion cost fudge factor to <percent>. Defaults to 60. Try a larger value if git range-diff erroneously considers a large change a total rewrite (deletion of one commit and addition of another), and a smaller one in the reverse case. See the Algorithm section below for an explanation of why this is needed.

--left-only

Suppress commits that are missing from the first specified range (or the "left range" when using the <rev1>...<rev2> form).

--right-only

Suppress commits that are missing from the second specified range (or the "right range" when using the <rev1>...<rev2> form).

--diff-merges=<format>

Instead of ignoring merge commits, generate diffs for them using the corresponding --diff-merges=<format> option of 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.

--notes[=<ref>]
--no-notes

This flag is passed to the git log program (see 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