Re: Editing the root commit
From: Chris Webb <hidden>
Date: 2016-06-15 22:54:09
Junio C Hamano [off-list ref] writes: [detached unborn HEAD]
No thanks. It will be too big a change to the fundamental invariant for what a git directory is (and isn't). It is simply unacceptable to suddenly start treating a random directory that does not even have HEAD as a git directory.
No problem. I imagine you wouldn't be keen on other representations of the same state either, e.g. a null sha1 in HEAD, and would prefer to disallow it altogether? In that case, would you like me to do a test and a fix for the '(null)' branch behaviour of git checkout --orphan dummy && git checkout --detach ? I assume that can't be intentional: looks from the code like it was intended to tell me I'm on an unborn branch and can't do that.
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. I imagine we wouldn't want to make rebase -i much more complicated (and consequently harder to work on) just to cover this rarely needed variant, but if it's relatively self-contained (e.g. detect we're supposed to be making an orphan commit and do it by hand instead of with git commit, maybe?) it would presumably be worthwhile? Cheers, Chris.