Reading a few "Why a DVCS is better" answers to several question on Programmers.SE they all seem to say that in general, DVCS is better since you don't have a commit race in large projects, IE commit, out of date so update, commit, out of date again, commit, still out of date, etc.

DVCS limit this with the concept of the push. However in very large projects wouldn't there be a "push race", especially at the end of the day? I know in Git this is somewhat remedied by the constant branching for everything, but in Mercurial you don't branch, you create a new head.

Problem I see

  1. User attempts to push
  2. Out of date (mercurial won't let you push if your local repo is out of date), so you pull and merge your local changes
  3. User attempts to push again but while they were merging someone else pushed, so they are out of date again
  4. Pull and merge again
  5. Still out of date
  6. Repeat

Sound familiar?

Is this an actual problem with very large and popular mercurial repos? What about inside a company when everyone does their final push of the day?

  • who doesn't branch in mercurial? hg branch myfeature; hg ci -m "Starting feature branch"; hg push --new-branch Commented Jun 5, 2011 at 23:13
  • @Carson In git branches are cheap. In mercurial they are much more permanent. Generally I've heard that in git you branch to work on a feature, in mercurial you create a new head or clone to a different directory.
    – TheLQ
    Commented Jun 6, 2011 at 3:14
  • well you can add a --close-branch when committing -- and mercurial has named branches, you don't have to clone to a new directory Commented Jun 6, 2011 at 3:45
  • @Carson I'm not saying you can't or that its not possible, I'm just saying I've always heard that the convention was to clone or create a new head, not branch. Most mercurial repos I've seen only have a few branches while git repos tend to have a bunch
    – TheLQ
    Commented Jun 6, 2011 at 3:54
  • I'm not sure, I've never used git Commented Jun 6, 2011 at 4:30

2 Answers 2


As far as I'm aware most of the big open source projects using DVCS use "pull requests" instead of pushes, i.e. a user requests that the project pulls from their branch, and the prject can choose to undertake these pull requests in any order, if at all. This eliminates the needs for the "push race", as you've named it.

In other companies I can't vouch for process, but where I work this isn't an issue.

See, when you're working on a case you're working on a branch of the entire repo, so your push requests go to a remote version of the main trunk. When you want to integrate your (finished) change into the trunk you load up the trunk, pull, merge, push.

Occasionally (very occasionally) two people will try and do this at the same time (usual due to some miscommunication). In this case whoever "loses" will just have to re-pull, merge, push. Since there's no 5pm rush to commit to a central repository the problem you've outlined isn't really there.

That's the beauty of DVCS: branching is painless, so everyone can work on their own branch.


Oh, I just noticed your "In mercurial you don't branch..." comment: Yes, you do. You don't have to, but since it's so easy to and the benefits of doing so outweigh not doing so do greatly, you do tend to just branch repos a lot.

  • I've always heard that you clone to work on experimental features, not branch. Most of the reasons I heard is that in mercurial branches are much more permanent than in Git. I could be wrong however
    – TheLQ
    Commented Jun 6, 2011 at 3:17
  • That's the thing, as far as mercurial is concerned a clone is a branch, you can still do pretty much everything you can do with a standard "head" (and some more stuff!), but you have the added luxury of the pull/push level of distance from the trunk. I'm not sure what you mean about permanence, when you're done with your clone you can just delete it.
    – Ed James
    Commented Jun 6, 2011 at 9:26
  • How come there is no 5pm push rush? Commented Jun 6, 2011 at 21:23
  • Like I said, most of the time everyone is working on their own branch (you're very unlikely to be working on exactly the same issue as another person), so while everyone does push at the end of the day it's to different branches. Plus, at my work we have flex time so it's more of a 4pm-6pm rush ;)
    – Ed James
    Commented Jun 7, 2011 at 7:43

No, there isn't a push race because work is done in topic branches. A merge master manages the (relatively lower) complexity of combining the branches into an integration branch. This is usually done continuously. For more info on distributed version control workflows, the first source would be the horse's mouth: man gitworkflows, online here. Mercurial workflows do use branching despite your claim and the techniques are similar.

  • The OP is making a distinction about git and hg here but your answer is aimed for git (the first link is very git-oriented, for example). It's a correct answer (as the OP's original mis-interpretation of branching in hg lead to the question itself), but it's worth noting that it's the same for hg.
    – Ed James
    Commented Jun 5, 2011 at 22:07
  • @Ed Good point, updated to clarify that the answer applies to both git and mercurial. Commented Jun 5, 2011 at 22:13
  • see the repository git.git, it is a good example of merging using DVCS. There are lots of merge points. There may be more than 10 temporary branches at the same time before finally merged into main branch.
    – linquize
    Commented Jul 26, 2012 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.