Subject: Re: Editing the root commit

From: Chris Webb <[email-masked]>
Date: Fri, 22 Jun 2012 23:26:34 +0100

Chris Webb <[email-masked]> writes:

> Junio C Hamano <[email-masked]> writes:
> 
> > It would be a lot more palatable approach to teach "rebase -i" defer
> > its "detaching HEAD to the onto commit" step before starting to read
> > the insn sheet.  Would such a change be too involved for it to be
> > worth supporting "rebase --root -i"?
> 
> I'm not sure as I don't really know the rebase shell scripts well at all,
> but I'm happy to take a look and see.

Ignoring the implementation, I think the nastiest bit here is what happens
for the user if there's a conflict, as Peff pointed out. Ideally, we want to
checkout a state we're going to replay the patch onto, so that if we drop
out because there's conflict (e.g. the patch modifies a file which doesn't
exist yet), git diff and git diff --cached do something sensible.

Without a detached orphan checkout, as Peff says, we'd have to put a
temporary empty commit in and then manually make the first commit avoiding
using it as a parent, which is very ugly. I'll take a look, but might be too
complex to be worth doing for this corner-case.

Cheers,

Chris.