aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/git-diff.txt
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2020-09-14 11:36:52 -0700
committerJunio C Hamano <gitster@pobox.com>2020-09-21 13:37:03 -0700
commit3d09c22869a7bd47f1683031937af0ed93b2fa3b (patch)
tree045ced9ffc692b665a5eec38611e9f75755399e4 /Documentation/git-diff.txt
parent0f5a1d449b9538c2765de9d6683abbb83a7fb4e2 (diff)
downloadgit-3d09c22869a7bd47f1683031937af0ed93b2fa3b.tar.gz
builtin/diff-tree: learn --merge-base
The previous commit introduced ---merge-base a way to take the diff between the working tree or index and the merge base between an arbitrary commit and HEAD. It makes sense to extend this option to support the case where two commits are given too and behave in a manner identical to `git diff A...B`. Introduce the --merge-base flag as an alternative to triple-dot notation. Thus, we would be able to write the above as `git diff --merge-base A B`. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-diff.txt')
-rw-r--r--Documentation/git-diff.txt8
1 files changed, 6 insertions, 2 deletions
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index 762ee6d074..7f4c8a8ce7 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -11,7 +11,7 @@ SYNOPSIS
[verse]
'git diff' [<options>] [<commit>] [--] [<path>...]
'git diff' [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]
-'git diff' [<options>] <commit> [<commit>...] <commit> [--] [<path>...]
+'git diff' [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]
'git diff' [<options>] <commit>...<commit> [--] [<path>...]
'git diff' [<options>] <blob> <blob>
'git diff' [<options>] --no-index [--] <path> <path>
@@ -62,10 +62,14 @@ of <commit> and HEAD. `git diff --merge-base A` is equivalent to
branch name to compare with the tip of a different
branch.
-'git diff' [<options>] <commit> <commit> [--] [<path>...]::
+'git diff' [<options>] [--merge-base] <commit> <commit> [--] [<path>...]::
This is to view the changes between two arbitrary
<commit>.
++
+If --merge-base is given, use the merge base of the two commits for the
+"before" side. `git diff --merge-base A B` is equivalent to
+`git diff $(git merge-base A B) B`.
'git diff' [<options>] <commit> <commit>... <commit> [--] [<path>...]::