git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What are branches?

From
MGMichael J Gruber <drmicha@warpmail.net>
Date
Apr 20, 2009, 14:27 UTC
Message-ID
<49EC8648.6000608@warpmail.net>
In-Reply-To
<200904201614.07735.fge@one2team.com>
Francis Galiegue venit, vidit, dixit 20.04.2009 16:14:
Show 9 quoted lines
> 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
Show 7 quoted lines
> 
>> 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 ;)

Previous: Felipe Contreras
Message 28 of 28 in “What are branches?”
  1. Johannes SchindelinApr 19, 2009
  2. Michael WittenApr 19, 2009
  3. Tuncer AyazApr 19, 2009
  4. Johannes SchindelinApr 19, 2009
  5. Tuncer AyazApr 19, 2009
  6. Dmitry PotapovApr 20, 2009
  7. Michael J GruberApr 20, 2009
  8. Dmitry PotapovApr 20, 2009
  9. Michael J GruberApr 20, 2009
  10. Dmitry PotapovApr 20, 2009
  11. Junio C HamanoApr 20, 2009
  12. Marius VollmerApr 20, 2009
  13. Junio C HamanoApr 21, 2009
  14. Dmitry PotapovApr 21, 2009
  15. Johannes SchindelinApr 20, 2009
  16. Björn SteinbrinkApr 20, 2009
  17. Jakub NarebskiApr 20, 2009
  18. Björn SteinbrinkApr 20, 2009
  19. Jakub NarebskiApr 24, 2009
  20. Björn SteinbrinkApr 24, 2009
  21. Dmitry PotapovApr 20, 2009
  22. Johannes SchindelinApr 20, 2009
  23. Michał KiedrowiczApr 20, 2009
  24. Dmitry PotapovApr 20, 2009
  25. Björn SteinbrinkApr 20, 2009
  26. Brian GernhardtApr 20, 2009
  27. Felipe ContrerasApr 25, 2009
  28. Michael J GruberApr 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.