Subject: Re: [PATCH 0/3] rebase: learn --keep-base

From: Denton Liu <[email-masked]>
Date: Tue, 26 Mar 2019 10:50:52 -0700

Hi Ævar,

On Tue, Mar 26, 2019 at 03:35:34PM +0100, Ævar Arnfjörð Bjarmason wrote:
> 
> On Sat, Mar 23 2019, Denton Liu wrote:
> 
> > This series teaches rebase the --keep-base option.
> >
> > 'git rebase --keep-base <upstream>' is equivalent to
> > 'git rebase --onto <upstream>... <upstream>' or
> > 'git rebase --onto $(git merge-base <upstream> HEAD) <upstream>' .
> >
> > This seems to be a common case that people (including myself!) run into; I was
> > able to find these StackOverflow posts about this use case:
> >
> > * https://stackoverflow.com/questions/53234798/can-i-rebase-on-a-branchs-fork-point-without-explicitly-specifying-the-parent
> > * https://stackoverflow.com/questions/41529128/how-do-you-rebase-only-changes-between-two-branches-into-another-branch
> > * https://stackoverflow.com/a/4207357
> 
> Like with another series of yours I think this would be best squashed
> into one patch.

Will do.

> 
> Maybe I've misunderstood this but isn't this like --fork-point except
> with just plain "git merge-base" instead of "git merge-base
> --fork-point", but then again 2/3 shows multiple base aren't supported,
> but merge-base supports that.
> 

--fork-point gets used to determine the _set of_ commits which are to be
rebased, whereas --keep-base (and --onto) determine the base where that
set of commits will be spliced. As a result, these two options cover
orthogonal use-cases.

The reason why --keep-base doesn't support multiple bases for the same
reason that --onto already disallows multiple bases. If we have multiple
bases, how do we determine which one is the "true base" to use? It makes
more sense to error out and let the user manually specify it.

> I'd find something like the "DISCUSSION ON FORK-POINT MODE" in
> git-merge-base helpful with examples of what we'd pick in the various
> scenarios, and also if whatever commit this picks was something you
> could have "git merge-base" spew out, so you could get what rebase would
> do here from other tooling (which maybe is possible, but I'm confused by
> the "no multiple bases"...).

If I'm understanding you correctly then yes, this could be done with
other tooling. See the 0/3 for equivalent commands.

Perhaps I should update the rebase documentation to mention that
--fork-point and --keep-base are orthogonal because it's unclear for
you, it's probably unclear for other users as well.

Thanks,

Denton