this post was submitted on 11 Apr 2025
456 points (98.7% liked)

Programming

19468 readers
111 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 !webdev@programming.dev



founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] alsimoneau@lemmy.ca 3 points 3 days ago (1 children)

No, git has labels on heads of branches. Once the head moves you loose the information. It also makes for a more messy history, which I believe created the whole "rebase everything" philosophy to cope.

[–] SpaceNoodle@lemmy.world 4 points 3 days ago (1 children)

What information is "loosed" when another commit is made to the branch?

[–] bleistift2@sopuli.xyz 1 points 3 days ago* (last edited 3 days ago) (1 children)

If I hand you a commit, you cannot tell which ‘branch’ it is on without searching the git history and hoping that you only get one answer. That’s a bummer if, for instance, you’re a github action and only get handed the commit. If it’s on the master branch, I want to do different things than if it’s a dev branch.

[–] SpaceNoodle@lemmy.world 3 points 3 days ago (1 children)

A commit all by itself doesn't mean as much without context.

Why would I not want to be able to apply a commit to any arbitrary branch?

Also, GitHub is not git - it's based on git. Any shortcomings it may have aren't necessarily due to a flaw in git.

[–] bleistift2@sopuli.xyz 1 points 3 days ago* (last edited 3 days ago) (1 children)

A commit all by itself doesn’t mean as much without context.

Luckily a commit points to its parent, which means the context is inherently present. What’s your point?

Why would I not want to be able to apply a commit to any arbitrary branch?

Nobody said that.

Any shortcomings it may have aren’t necessarily due to a flaw in git.

True enough.

[–] SpaceNoodle@lemmy.world 1 points 3 days ago (1 children)

Your claim appears to be that Mercurial binds commits to branches, and I'm explaining how I fail to see the advantage.

[–] alsimoneau@lemmy.ca 0 points 3 days ago (1 children)

It makes the history clearer.

[–] SpaceNoodle@lemmy.world 2 points 3 days ago (1 children)

How is a Mercurial commit tree clearer than a git commit tree?

[–] alsimoneau@lemmy.ca 0 points 2 days ago (1 children)

Branches are distinct.

Let's say you have a main and a dev branch, and you periodically merge dev into main. Because of fast forwarding (on by default) the main branch is completely gone from the history. If you then add bug fixes and project branches it becomes a tangled mess really quickly and it's nearly impossible to understand the structure by looking at the tree.

On mercurial every branch is named and distinct forever. You don't have to try to understand what happened to the project since it's obvious by looking at the tree.

Now there are ways to have a clean git history, but afaik you either need to make sure nobody ever messes it up or have everyone rebase everything and only keep the history of the main branch.

When working in a hyper structured organization that may work, but for more casual developers (scientists, students) that aren't system experts and where you have messy history, mercurial default settings are less confusing, easier to learn and produce better results.

[–] SpaceNoodle@lemmy.world 1 points 2 days ago

No, merging in git does not make branches disappear.