Re: [PATCH v3 2/2] merge-base: teach "--fork-point" mode
On Fri, Oct 25, 2013 at 5:38 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 28 quoted lines
> diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
> index 87842e3..b383766 100644
> --- a/Documentation/git-merge-base.txt
> +++ b/Documentation/git-merge-base.txt
> @@ -137,6 +143,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 stated on top of it back
> +when `origin/master` was at B3. This mode uses the reflog of
> +`origin/master` to finds B3 as the fork point, so that the `topic`
Show 8 quoted lines
> +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
> --------