this post was submitted on 24 Nov 2023
30 points (100.0% liked)

Programming

17026 readers
75 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 9 months ago* (last edited 9 months ago)

My graph theory is a bit fuzzy but I think that the definition of a branch in a directed graph corresponds to the path between two nodes/vertices.

No, it's a subtree of a DAG (directed acyclic graph). The technical term is arborescence but people who can't spell it say branch instead.

Technically it should have at least 2 children to be called a branch, and it can't connect back to the graph or it's not a subtree anymore. So it fits what most people intuitively think a (real) tree branch should look like.

I don’t think Git invented this concept, nor did any other version control system.

They didn't, but Git went too far by calling any node with a label a "branch" regardless if it's in the middle of the DAG. It doesn't fit graph theory and it doesn't fit the intuitive image either.

Edit: Also, most of the source control systems that preceded Git were very rudimentary, they branch merging was either deficient or non-existent so most of them only used subtrees which never tied back to trunk. So for them "branch" was appropriate most of the time.