Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6706685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:32:58+00:00 2026-05-26T07:32:58+00:00

Please note : I’m not trying to restart the argument whether Mercurial or Git

  • 0

Please note: I’m not trying to restart the argument whether Mercurial or Git is better, I just have a technical question that I, as a Mercurial user, don’t understand. I’m also not sure whether SO is the right place to ask such a question, but it is programming related.

There have been many discussions about how the two version control systems Git and Mercurial differ from each other from a user’s point of view (e.g. What is the Difference Between Mercurial and Git? and http://felipec.wordpress.com/2011/01/16/mercurial-vs-git-its-all-in-the-branches/ ), and the major difference is the handling of branches. I have read through many of these discussions, but I keep asking myself this question:

Why does Git not store the branch name as part of the commit?

I don’t really see a good reason for not doing that; it means that data can’t just simply vanish because there is no reference (tag, branch, whatever) poiting to it.

I see storing the branch in the commit as a big plus for Mercurial, because that makes it more difficult to lose data.

The main point of the Git crowd in favor of Git’s branching model, that you can simply delete branches, does not prevent Git from storing the name of the branch as part of each commit: If the commits of a branch are deleted, so are the references to that branch. It will also not interfere with the “cheap branching” argument: branches will not be more expensive to manage. And I don’t think that the additional storage needed should be of concern: it’s just a couple of bytes per commit.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:32:59+00:00Added an answer on May 26, 2026 at 7:32 am

    One of the definitive source about branches for Git and Mercurial is the SO question:

    “Git and Mercurial – Compare and Contrast“

    In Git references (branches, remote-tracking branches and tags) reside outside DAG of commits.

    (That allows to manage different namespaces regarding branches, for local and remote branches)

    You have a similar notion with Mercurial with bookmark branches (which can be pushed/pulled).

    Note that in Git, the data won’t “vanish” because there is no reference: you still have the reflog to retrieve those unreferenced commits.

    Why does Git not store the branch name as part of the commit?
    I don’t really see a good reason for not doing that

    The idea is to separate what has changed (the commits) from whym ie from the context of the change (the name of the branch).
    Since you can fast-forward merge a branch, commits from one branch can be part of another at any time.

    That is why Jakub Narębski questioned the design of Mercurial “named branches” (with branch names embedded in changeset metadata), especially with a global namespace, not very suited for a distributed version control system.

    You create a branch to isolate a development effort (see “When should you branch?“), but with a DVCS, that development effort (the set of commits) should be published under any branch name. What local context (branch name) you have defined might not be valid once published to another Git repo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PLEASE NOTE: This is a CODE QUESTION NOT AN SYSTEM MANIPULATION ONE. I have
(Please note that I have seen a similar question on StackOverflow recently, however I
Please note: This is a question about the Eclipse plugin Subversive , and not
Please note this is not a question about online/hosted SVN services. I am working
Please note this is a question with regard to Backbone.js. This is not a
Please note that this is asking a question about constructors, not about classes which
I’m using Drupal (please note that this is not a Drupal related question), and
Please note: This question relates to the Appcelerator Titanium platform, not the stock iOS
Please note that this question is not about the mysql query per se, but
Please note that this question is not about the mysql query per se, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.