Re:Git Branches: Intuition and Reality
by mr_mitm on Thursday November 23, 2023 @12:30PM
(#38395165)
When the entire structure of commits is called a tree, I find the name "branch" fitting. The branch is identified by its head commit, so the path from head to root is uniquely defined and that's the branch. (Disregarding merges for now.)
[ Parent
| on HN ]
Re:Git Branches: Intuition and Reality
by cpeterso on Thursday November 23, 2023 @03:08PM
(#38396956)
Leaning into the tree metaphor (and following the precedent of other version control systems), git should have used the term trunk instead of master or main.
Why? That would heavily imply that master/main is somehow technically different from all other branches (since a trunk is certainly not a branch), which to my knowledge is not true.
I see what you mean, but don't "master" and "main" also imply some special authority? Trunk-based development with branches forking off and merging back into the trunk (a DAG, unlike a real tree! :) is an extremely common workflow.
By following this metaphor, a trunk would be the original commit, whereas branches are the tree branch tips.
Re:Git Branches: Intuition and Reality
by galaxyLogic on Thursday November 23, 2023 @08:24PM
(#38399795)
And consider that because every folder can have its own .git subfolder, we can have several paralle trunks/repositories at the same time, meaning we have a forest.
I haven't really seen specific guidelines as to when and why should anyone start a new repo. Are there some? Or is "mono-repo" the best solution, and when and for whom. Surely we need more than one git-repo in the whole world?!
Re:Git Branches: Intuition and Reality
by TeMPOraL on Thursday November 23, 2023 @12:43PM
(#38395305)
> Disregarding merges for now.
Without disregarding them, it's not a tree, but a DAG.
Re:Git Branches: Intuition and Reality
by dayjaby on Thursday November 23, 2023 @04:42PM
(#38397900)
It is a tree. What makes you think it's just a DAG? Are there commits with multiple parent commits or what?
There absolutely can be. Merge commits have multiple parent commits for example. It's definitely a graph not just a tree.
Re:Git Branches: Intuition and Reality
by dayjaby on Thursday November 23, 2023 @05:41PM
(#38398479)
Parent comment was about disregarding merge commits.
You can't disregard merge commits. It's part of the structure.
Yes. Merge commits have two parents.
Two or more. I'm not sure there's a limit.
Try not to do this (imagine a 5-way merge conflict).