Subject: Re: What are branches?

From: Michael J Gruber <[email-masked]>
Date: Mon, 20 Apr 2009 16:27:20 +0200

Francis Galiegue venit, vidit, dixit 20.04.2009 16:14:
> Le lundi 20 avril 2009, vous avez écrit :
>> Dmitry Potapov venit, vidit, dixit 20.04.2009 15:24:
>>
>> There is nothing in a git commit that ties it to a specific branch; in
>> that sense, it does not "belong" to any.
>>
> 
> Yes there is: the branch you are currently on (shown by, among others, "git 
> branch").

No, there is not.

Proof: Delete that branch and the commit will still be there. QED

> 
>> A git branch is a pointer to a commit. That commit and its predecessors
>> are contained in the branch. A commit may be contained in multiple
>> branches, on equal footing: there is no "prime branch".
>>
> 
> No. A commit's SHA1 depends on all other commits.

...on all predecessors' SHA1s, to be exact.

Now, what does this have to do with the existence of a "prime branch",
which you claim?

> 
> Why do you think the rebase command exists at all?
> 

In order to change the DAG. It rewrites commits.

On the other hand: If I want to change what branch a commit "is on", I
use git branch -m to rename the branch or git reset etc. to change some
*descendant* commits of the commit in question. All of this does not
rewrite the commit in question, but changes the names resp. the number
of branches the commit is on. Which exactly proves my point.

git branches are different. Luckily they are!

Michael

P.S.: Please don't cull cc:
P.P.S.: I'll stop here with this thread. I assume you'll believe at
least Dscho if you don't believe me ;)