Re: master^ is not a local branch -- huh?!?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <7vbpgc8fhb.fsf@xxxxxxxxxxxxxxxxxxxxxxxx>,
 Junio C Hamano <gitster@xxxxxxxxx> wrote:

> Ron Garret <ron1@xxxxxxxxxxx> writes:
> 
> > 1.  The term "detached HEAD" is inherently misleading.  A detached HEAD 
> > isn't detached from anything, it's just pointing to the middle of a 
> > branch, which is to say, to a commit that happens to already have 
> > descendants.  For that matter, the name HEAD is itself misleading, since 
> > HEAD need not be the head of a branch (though normally it is).  A better 
> > name for HEAD would have been CURRENT or ACTIVE.  I recognize it's 
> > probably too late to change it now.
> 
> This description, especially the phrase "middle of a branch" shows that
> you don't understand git yet.

That could well be, but it's not for lack of trying :-)

> A git branch is _not_ a line (nor multiple
> lines) of development.  It is merely a _point_ in the history.

By "middle of a branch" I simply meant "a commit that already has one or 
more descendants" (or, to be even more precise, a commit that has one or 
more commits that reference that commit as one of their predecessors).  
I do understand that histories aren't linear.

> "A commit that is in the middle of an ancestry chain with existing
> descendants" can be at the tip of a branch and does not have anything to
> do with detached HEAD state.

Ah, then you're right.  I really don't get it yet.

> When HEAD points at a branch, making a commit advances _that_ branch.  And
> we say you are "on that branch".  When HEAD is detached, because it is not
> attached to anything, it advances no branch.  "detached HEAD" is detached
> in the very real sense.  It is not attached to _any_ branch.

OK.  The docs do not make that clear at all.  In fact, the following 
statement, copied straight from the manual, flatly contradicts what you 
just said:

"The special symbol "HEAD" can always be used to refer to the current 
branch."

Always.  Except when it can't.

Soooo.....

Sometimes HEAD can refer to a branch head which is a pointer to a 
commit, and sometimes HEAD can refer to a commit directly without 
indirecting through a branch head (lower case), in which case it is 
detached.  Is that right?

If that's true, then I'm back to wondering what good is a detached head.  
Why would you ever want one?  What can you do with a detached head that 
you could not do just as easily without one?

rg

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]