poll: how do you think about git branches? (I'll put an image in a reply with pictures for the 3 options)

@b0rk #1 doesn't make any sense and easily falls apart at edge cases, if you think this way you'll sooner or later make yourself confused; #2 can be useful when reasoning or talking about repo topology as a kind of mental shortcut (and actually applies to any commit, not just those pointed to by branches); #3 is the truth.

@dos
It does not make sense from a git technology point of view, but it makes perfect sense from a code history point of view, and that really is the only view that matters when talking about branches IMO.

I mean, git is just the implementation.
@b0rk

@wouter @b0rk The question was about git branches specifically, your reply seems off-topic to me. The implementation doesn't matter (otherwise the answer would be "it's a file"); what matters is git's data model, which is what the user operates on conceptually and where the concept of branch is clearly defined. When the model in your head doesn't match the real one, you're setting yourself up for trouble (or xkcd 1597 :P)

@dos
Respectfully disagree.

The question was, how do you think about git branches.

I know that the technical implementation of a git branch is just a pointer to a single commit which can move around to other commits, with some overridable safeguards so you don't get too surprised when things are done. However, that's not a very useful way to think about it, IMO.
@b0rk

@wouter @b0rk It's not "technical implementation", it's the whole concept of a branch in git. Understanding that lets you use branches in git with ease regardless of context they appear in. You don't have to bother with technical implementation at all, it doesn't matter - the concept does.

The option one does not help to understand git, I have repos where branches don't "branch off" from any common point at all. Such a model in one's head just causes confusion.

@dos
Sigh.

The question is not 'how does git implement branches', it's 'how do you think of branches in git'

My answer is closest to option 1.

I know that's not how git works! But that's fine.

What you don't seem to understand is that it's perfectly possible to have a simplified mental model of how software works, which lets you get on with actual with, without getting confused when the model doesn't match reality, because you're aware that your mental model is @b0rk
incomplete and there are edge cases where it will fall on its face.

When that happens, I'll remember how things work technically and resolve the situation.

But for everyday work? Nope, not happening.

And yes, I *also* have git repositories with multiple root commits. Doesn't change about how I think about branches.
@b0rk @dos
Follow

@wouter @b0rk Sorry, but it's you who got angry at how I answered the question "how I think about git branches".

Sign in to participate in the conversation
Librem Social

Librem Social is an opt-in public network. Messages are shared under Creative Commons BY-SA 4.0 license terms. Policy.

Stay safe. Please abide by our code of conduct.

(Source code)

image/svg+xml Librem Chat image/svg+xml