summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-12-05 20:58:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-12-05 20:58:27 (GMT)
commit07d406b742b577a39d7cbdacd76d0dde021ff788 (patch)
treeb9c83d886e3b8a5d0169f85b08ac8f52091a4d7b /Documentation
parent219ea0e79d1e5cdb5f1133aff70fe4e5737dd59d (diff)
parentd96855ff517560650c62eca51a8bb78263f6a3ef (diff)
downloadgit-07d406b742b577a39d7cbdacd76d0dde021ff788.zip
git-07d406b742b577a39d7cbdacd76d0dde021ff788.tar.gz
git-07d406b742b577a39d7cbdacd76d0dde021ff788.tar.bz2
Merge branch 'jc/merge-base-reflog'
Code the logic in "pull --rebase" that figures out a fork point from reflog entries in C. * jc/merge-base-reflog: merge-base: teach "--fork-point" mode merge-base: use OPT_CMDMODE and clarify the command line parsing
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/git-merge-base.txt38
1 files changed, 36 insertions, 2 deletions
diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
index 87842e3..808426f 100644
--- a/Documentation/git-merge-base.txt
+++ b/Documentation/git-merge-base.txt
@@ -13,6 +13,7 @@ SYNOPSIS
'git merge-base' [-a|--all] --octopus <commit>...
'git merge-base' --is-ancestor <commit> <commit>
'git merge-base' --independent <commit>...
+'git merge-base' --fork-point <ref> [<commit>]
DESCRIPTION
-----------
@@ -24,8 +25,8 @@ that does not have any better common ancestor is a 'best common
ancestor', i.e. a 'merge base'. Note that there can be more than one
merge base for a pair of commits.
-OPERATION MODE
---------------
+OPERATION MODES
+---------------
As the most common special case, specifying only two commits on the
command line means computing the merge base between the given two commits.
@@ -56,6 +57,14 @@ from linkgit:git-show-branch[1] when used with the `--merge-base` option.
and exit with status 0 if true, or with status 1 if not.
Errors are signaled by a non-zero status that is not 1.
+--fork-point::
+ Find the point at which a branch (or any history that leads
+ to <commit>) forked from another branch (or any reference)
+ <ref>. This does not just look for the common ancestor of
+ the two commits, but also takes into account the reflog of
+ <ref> to see if the history leading to <commit> forked from
+ an earlier incarnation of the branch <ref> (see discussion
+ on this mode below).
OPTIONS
-------
@@ -137,6 +146,31 @@ In modern git, you can say this in a more direct way:
instead.
+Discussion on fork-point mode
+-----------------------------
+
+After working on the `topic` branch created with `git checkout -b
+topic origin/master`, the history of remote-tracking branch
+`origin/master` may have been rewound and rebuilt, leading to a
+history of this shape:
+
+ o---B1
+ /
+ ---o---o---B2--o---o---o---B (origin/master)
+ \
+ B3
+ \
+ Derived (topic)
+
+where `origin/master` used to point at commits B3, B2, B1 and now it
+points at B, and your `topic` branch was started on top of it back
+when `origin/master` was at B3. This mode uses the reflog of
+`origin/master` to find B3 as the fork point, so that the `topic`
+can be rebased on top of the updated `origin/master` by:
+
+ $ fork_point=$(git merge-base --fork-point origin/master topic)
+ $ git rebase --onto origin/master $fork_point topic
+
See also
--------