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

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

 



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

> Ron Garret <ron1@xxxxxxxxxxx> writes:
> 
> >> For my rather fresh eye it looks more like unnamed (anonymous?) branch
> >> than a temporary one. Doesn't detached HEAD behave exactly like a
> >> regular HEAD but pointing to the tip of an unnamed branch?
> >
> > I strongly concur with this.
> >
> > And as long as I'm weighing in, it would also help to prevent confusion 
> > if it were made clear that this unnamed branch doesn't actually come 
> > into existence unless and until you do a commit.
> 
> This shows that you are still thinking a branch is a line (or multiple
> lines).  It is not.

The git user's guide says it is:

"When we need to be precise, we will use the word "branch" to mean a 
line of development..."

But I understand that a branch is not necessarily a line.  In general 
it's a DAG.  I get that.

The manual goes on to say:

"...and "branch head" (or just "head") to mean a reference to the most 
recent commit on a branch."

There are two ways this can be interpreted:

1.  A commit pointed to by a branch head cannot have any descendants.  
Because if it did it would not be the most recent commit on that branch, 
and by definition a branch head must point at the most recent commit.

2.  Any commit can be considered a branch head for a branch consisting 
of (for example) the transitive closure of its ancestors.

(Note that if I were being really strict with my terminology I would 
have to say: any commit can be considered the most recent commit for a 
branch consisting of...  Because a branch head by definition is a 
*reference* to a commit, so strictly speaking a commit cannot be a 
branch head.  The problem is that there are three concepts in play, but 
only two terms by which to refer to them.)

I personally think interpretation #1 makes more sense, and is a better 
match to most people's intuitions about what it means to be a branch 
head.  But in neither case does simply moving HEAD "create" a branch.  
Even under interpretation 2, all those anonymous branches were there all 
along.  You don't "create" anything, temporary or otherwise, simply by 
moving HEAD.

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]