Skip to content

Commit 8de4338

Browse files
committed
Merge branch 'vr/merge-base-doc' into maint
* vr/merge-base-doc: Restructure documentation for git-merge-base. Documentation: update to git-merge-base --octopus
2 parents f704591 + ded7e04 commit 8de4338

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

Documentation/git-merge-base.txt

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ git-merge-base - Find as good common ancestors as possible for a merge
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git merge-base' [-a|--all] [--octopus] <commit> <commit>...
12+
'git merge-base' [-a|--all] <commit> <commit>...
13+
'git merge-base' [-a|--all] --octopus <commit>...
1314
'git merge-base' --independent <commit>...
1415

1516
DESCRIPTION
@@ -22,23 +23,21 @@ that does not have any better common ancestor is a 'best common
2223
ancestor', i.e. a 'merge base'. Note that there can be more than one
2324
merge base for a pair of commits.
2425

25-
Unless `--octopus` is given, among the two commits to compute the merge
26-
base from, one is specified by the first commit argument on the command
27-
line; the other commit is a (possibly hypothetical) commit that is a merge
28-
across all the remaining commits on the command line. As the most common
29-
special case, specifying only two commits on the command line means
30-
computing the merge base between the given two commits.
26+
OPERATION MODE
27+
--------------
28+
29+
As the most common special case, specifying only two commits on the
30+
command line means computing the merge base between the given two commits.
31+
32+
More generally, among the two commits to compute the merge base from,
33+
one is specified by the first commit argument on the command line;
34+
the other commit is a (possibly hypothetical) commit that is a merge
35+
across all the remaining commits on the command line.
3136

3237
As a consequence, the 'merge base' is not necessarily contained in each of the
3338
commit arguments if more than two commits are specified. This is different
3439
from linkgit:git-show-branch[1] when used with the `--merge-base` option.
3540

36-
OPTIONS
37-
-------
38-
-a::
39-
--all::
40-
Output all merge bases for the commits, instead of just one.
41-
4241
--octopus::
4342
Compute the best common ancestors of all supplied commits,
4443
in preparation for an n-way merge. This mimics the behavior
@@ -51,6 +50,12 @@ OPTIONS
5150
from any other. This mimics the behavior of 'git show-branch
5251
--independent'.
5352

53+
OPTIONS
54+
-------
55+
-a::
56+
--all::
57+
Output all merge bases for the commits, instead of just one.
58+
5459
DISCUSSION
5560
----------
5661

@@ -89,6 +94,9 @@ and the result of `git merge-base A M` is '1'. Commit '2' is also a
8994
common ancestor between 'A' and 'M', but '1' is a better common ancestor,
9095
because '2' is an ancestor of '1'. Hence, '2' is not a merge base.
9196

97+
The result of `git merge-base --octopus A B C` is '2', because '2' is
98+
the best common ancestor of all commits.
99+
92100
When the history involves criss-cross merges, there can be more than one
93101
'best' common ancestor for two commits. For example, with this topology:
94102

builtin/merge-base.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
2323
}
2424

2525
static const char * const merge_base_usage[] = {
26-
"git merge-base [-a|--all] [--octopus] <commit> <commit>...",
26+
"git merge-base [-a|--all] <commit> <commit>...",
27+
"git merge-base [-a|--all] --octopus <commit>...",
2728
"git merge-base --independent <commit>...",
2829
NULL
2930
};

0 commit comments

Comments
 (0)