Re: erratic behavior commit --allow-empty
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Oct 3, 2012, 13:57 UTC
- Message-ID
- <vpqfw5v1wva.fsf@grenoble-inp.fr>
- In-Reply-To
- <CAB9Jk9BTCaV7RDx6_K+MKOeJTdOQPOwvnGM0UNxg9S8KMo4D4Q@mail.gmail.com>
Angelo Borsotti <angelo.borsotti@gmail.com> writes:
> [...] making then the orphan branch point to the master one, i.e. > becoming a non-orphan one.
I understand both parts of the sentense, but not the "i.e.".
And I still don't see a concrete problem. "two branches point to the same commit" is not a problem, it's an observation. I have branches pointing to the same commit all the time.
Show 7 quoted lines
>> I ended up with a branch "master" and a branch "new-branch", both >> pointing to the same commit. The new branch _is_ created. > > Exactly, it is created, but it is not an orphan ... or more precisely, > it is sometimes, depending on how fast you are to enter the second > commit command. This time-dependent behaviour is what I am talking > about.
You don't understand what an orphan branch is.
What "git checkout --orphan && git commit" does is that it creates a commit that doesn't have parent (hence the name orphan, btw). It does in your case. You _do_ create an orphan commit regardless of the timing.
The fact that another branch points to the same commit is a different matter, and you still didn't explain why this was problematic.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/