Re: [PATCH] provide a new "theirs" strategy, useful for rebase --onto
- From
Paolo Bonzini <bonzini@gnu.org>
- Date
- Jun 8, 2008, 23:06 UTC
- Message-ID
- <484C65F9.10007@gnu.org>
- In-Reply-To
- <7vk5gziqxn.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 11 quoted lines
> Paolo Bonzini <bonzini@gnu.org> writes: > >> #! /bin/sh >> # git-merge-after-amend <branch> >> # >> # Makes it possible to do a fast-forward merge of <branch> >> # into HEAD, assuming that the first diverging commit of <branch> >> # is an --amend'ed version of the first diverging commit of HEAD. > > Can this strong special case limitation "only the first one can be the > amend" somehow be loosened?
Well, the point of the exercise is to split a *single* commit into a "base" commit (already available, possibly on another branch) and a "delta" (the amending, transformed into an independent commit whose parent is the "base"). Indeed you can do that for any commit.
The script uses the "git-merge-base" to compute the "base", and takes the following commit (on the path to HEAD) as the "delta". That's what add the restriction. You can definitely make a two-argument variation that, given arguments "B C" and history
o--B (it is irrelevant if B and C have common parents)
o--o--C--D--E HEAD
makes
A--B--C'--D--E
Even in that case, I would make the script (which anyway is obviously not meant to be included in git, it's a commodity script) accept both variations: one-argument to do the special case, and two-arguments to generically split a commit into a base provided by the user + a delta.
Paolo