views:

5489

answers:

16

What do folks here see as the relative strengths and weaknesses of Git, Mercurial, and Bazaar?

In considering each of them with one another and against version control systems like SVN and Perforce, what issues should be considered?

In planning a migration from SVN to one of these distributed version control systems, what factors would you consider?

+1  A: 

This is a big question that depends a lot on context that would take you a lot of time to type into one of these little text boxes. Also, all three of these appear substantially similar when used for the usual stuff most programmers do, so even understanding the differences requires some fairly esoteric knowledge.

You will probably get much better answers if you can break your analysis of these tools down to the point at which you have more specific questions.

jfm3
So, maybe a meta-question: what are the questions which should be asked and the factors to consider?
Jordan
+89  A: 

Git is very fast, scales very well, and is very transparent about its concepts. The down side of this is that it has a relatively steep learning curve. A win32 port is available, but not quite a first-class citizen. Git exposes hashes as version numbers to users; this provides guarantees (in that a single hash always refers to the exact same content; an attacker cannot modify history without being detected), but can be cumbersome to the user. Git has a unique concept of tracking file contents, even as those contents move between files, and views files as first-level objects, but does not track directories. Another issue with git is that has many operations (such as rebase) which make it easy to modify history (in a sense -- the content referred to by a hash will never change, but references to that hash may be lost); some purists (myself included) don't like that very much.

Bazaar is reasonably fast (very fast for trees with shallow history, but presently scales poorly with history length), and is easy-to-learn to those familiar with the command-line interfaces of traditional SCMs (CVS, SVN, etc). Win32 is considered a first-class target by its development team. It has a pluggable architecture for different components, and replaces its storage format frequently; this allows them to introduce new features (such as better support for integration with revision control systems based on different concepts) and improve performance. The Bazaar team considers directory tracking and rename support first-class functionality. While globally unique revision-id identifiers are available for all revisions, tree-local revnos (standard revision numbers, more akin to those used by svn or other more conventional SCMs) are used in place of content hashes for identifying revisions. Bazaar has support for "lightweight checkouts", in which history is kept on a remote server instead of copied down to the local system and is automatically referred to over the network when needed; at present, this is unique among DSCMs.

Both have some form of SVN integration available; however, bzr-svn is considerably more capable than git-svn, largely due to backend format revisions introduced for that purpose.

I have not used Mercurial extensively, and so cannot comment on it in detail -- except to note that it, like Git, has content-hash addressing for revisions; also like Git, it does not treat directories as first-class objects (and cannot store an empty directory). It is, however, faster than any other DSCM except for Git, and has far better IDE integration (especially for Eclipse) than any of its competitors. Given its performance characteristics (which lag only slightly behind those of Git) and its superior cross-platform and IDE support, Mercurial may be compelling for teams with significant number of win32-centric or IDE-bound members.

One concern in migrating from SVN is that SVN's GUI frontends and IDE integration is more mature than that of any of the distributed SCMs. Also, if today you make heavy use of precommit script automation with SVN (ie. requiring unit tests to pass before a commit can proceed), you'll probably want to use a tool similar to PQM for automating merge requests to your shared branches.

SVK is a DSCM which uses Subversion as its backing store, and has quite good integration with SVN-centric tools. However, it has dramatically worse performance and scalability characteristics than any other major DSCM (even Darcs), and should be avoided for projects which are liable to grow large in terms of either amount of history or number of files.

[About the author: I use Git and Perforce for work, and Bazaar for my personal projects and as an embedded library; other parts of my employer's organization use Mercurial heavily. In a previous life I built a great deal of automation around SVN; before that I have experience with GNU Arch, BitKeeper, CVS and others. Git was quite off-putting at first -- it felt like GNU Arch inasmuch as being a concept-heavy environment, as opposed to toolkits built to conform to the user's choice of workflows -- but I've since come to be quite comfortable with it].

Charles Duffy
Heya. I just want to you know that cscvs is still being used to run Launchpad code imports, and I had the Canonical version released when I worked there.
ddaa
Very well put, thank you Charles.
Valentin Vasiliev
great summary Charles.
neoneye
+7  A: 

Mercurial and Bazaar resemble themselves very much on the surface. They both provide basic distributed version control, as in offline commit and merging multiple branches, are both written in python and are both slower than git. There are many differences once you delve into the code, but, for your routine day-to-day tasks, they are effectively the same, although Mercurial seems to have a bit more momentum.

Git, well, is not for the uninitiated. It is much faster than both Mercurial and Bazaar, and was written to manage the Linux kernel. It is the fastest of the three and it is also the most powerful of the three, by quite a margin. Git's log and commit manipulation tools are unmatched. However, it is also the most complicated and the most dangerous to use. It is very easy to lose a commit or ruin a repository, especially if you do not understand the inner workings of git.

Herge
Mercurial is really on par with Git. The performance is not big difference. But bazaar, is waaaay slower than Mercurial and Git.
jpartogi
@jpartogi - Bazaar's performance numbers have been improving much faster than its competitors, so I'd be cautious making that kind of assertion -- particularly with the storage refactoring that's available as preview in current releases and scheduled to become default in 2.0.
Charles Duffy
A: 

Distributed version control systems (DVCSs) solve different problems than Centralized VCSs. Comparing them is like comparing hammers and screwdrivers.

Centralized VCS systems are designed with the intent that there is One True Source that is Blessed, and therefore Good. All developers work (checkout) from that source, and then add (commit) their changes, which then become similarly Blessed. The only real difference between CVS, Subversion, ClearCase, Perforce, VisualSourceSafe and all the other CVCSes is in the workflow, performance, and integration that each product offers.

Distributed VCS systems are designed with the intent that one repository is as good as any other, and that merges from one repository to another are just another form of communication. Any semantic value as to which repository should be trusted is imposed from the outside by process, not by the software itself.

The real choice between using one type or the other is organizational -- if your project or organization wants centralized control, then a DVCS is a non-starter. If your developers are expected to work all over the country/world, without secure broadband connections to a central repository, then DVCS is probably your salvation. If you need both, you're fsck'd.

Craig Trader
There are very significant differences between CVS, SVN and VisualSourceSafe (to name but 3) that have a serious impact on their utility - and these are not just workflow and/or integration issues.
Murph
I've used all three of those, and technically you are correct, but from a high-level perspective my answer is valid as well. Version Control for more than a single developer is an organizational tool; as long as the tool meets the organization's needs, that's all that matters in the long run.
Craig Trader
+2  A: 

Bazaar is IMHO easier to learn than git. Git has a nice support in github.com.

I think you should try to use both and decide which suits you most.

rawicki
Mercurial is as easy as Bazaar, relatively fast compared to git and has nice support on Bitbucket. So what else could you ask?
jpartogi
+1  A: 

What do folks here see as the relative strengths and weaknesses of Git, Mercurial, and Bazaar?

This is a very open question, bordering on flamebait.

Git is fastest, but all three are fast enough. Bazaar is the most flexible (it has transparent read-write support for SVN repositories) and cares a lot about the user experience. Mercurial is somewhere in the middle.

All three systems have lots of fanboys. I am personally a Bazaar fanboy.

In considering each of them with one another and against version control systems like SVN and Perforce, what issues should be considered?

The former are distributed systems. The latter are centralized systems. In addition, Perforce is proprietary while all the others are free as in speech.

Centralized versus decentralized is a much more momentous choice than any of the systems you mentioned within its category.

In planning a migration from SVN to one of these distributed version control systems, what factors would you consider?

First, lack of a good substitute for TortoiseSVN. Although Bazaar is working on their own Tortoise variant, but it's not there yet, as of September 2008.

Then, training the key people about how using a decentralized system is going to affect their work.

Finally, integration with the rest of the system, such as issue trackers, the nightly build system, the automated test system, etc.

ddaa
For the record, current page states: "Since Bazaar version 1.6, TortoiseBZR is included in the official installer", so it seems to have matured.
PhiLho
+14  A: 

InfoQ has a nice comparison.

Pat Notz
+4  A: 

Sun did an evaluation of git, Mercurial, and Bazaar as candidates to replace the Sun Teamware VCS for the Solaris code base. I found it very interesting.

DGentry
those evaluations are somewhat outdated, newer versions have changed some of the disadvantages stated there.
hayalci
+1  A: 

ddaa.myopenid.com mentioned it in passing, but I think it's worth mentioning again: Bazaar can read and write to remote SVN repositories. That means you could use Bazaar locally as a proof-of-concept while the rest of the team is still using Subversion.

EDIT: Pretty much all the tool now have some way of interacting with SVN, but I now have personal experience that git svn works extremely well. I've been using it for months, with minimal hiccups.

Hank Gay
git also has interface into svn, but i haven't had a chance to properly use it yet - http://utsl.gen.nz/talks/git-svn/intro.html
Cebjyre
+1  A: 

Your major issue is going to be that these are Distributed SCMs, and as such require a bit of a change to the user's mindset. Once people get used to the idea the technical details and usage patterns will fall into place, but don't underestimate that initial hurdle, especially in a corporate setting. Remember, all problems are people problems.

David Plumpton
+8  A: 


What do folks here see as the relative strengths and weaknesses of Git, Mercurial, and Bazaar?

In my opinion Git strength is its clean underlying design and very rich set of features. It also has I think the best support for multi-branch repositories and managing branch-heavy workflows. It is very fast and has small repository size.

It has some features which are useful but take some effort to be used to them. Those include visible intermediate staging ara (index) between working area and repository database, which allows for better merge resolution in more complicated cases, incremental comitting, and comitting with dirty tree; detecting renames and copies using similarity heuristic rather than tracking them using some kind of file-ids, which works well and which allow for blame (annotate) which can follow code movement across files and not only wholesale renames.

One of its disadvantages is that MS Windows support lags behind and is not full. Another perceived disadvantage is that it is not as well documented as for example Mercurial, and is less user friendly than competition, but it changes.

In my opinion Mercurial strength lies in its good performance and small repository size, in its good MS Windows support.

The main disadvanatge is in my opinion the fact that local branches (multiple branches in single repository) is still second-class citizen, and in strange and complicated way it implements tags. Also the way it deals with file renames was suboptimal (but this migth have changed). Mercurial doesn't support octopus merges (with more than two parents).

From what I have heard and read main Bazaar advantages are it easy support for centralized workflow (which is also disadvantage, with centralized concepts visible where it shouldn't), tracking renames of both files and directories.

Its main disadvantage are performance and repository size for large repositories with long nonlinear history (the performance improved at least for not too large repositories), the fact that default paradigm is one ranch per repository (you can set it up to share data, though), and centralized concepts (but that also from what I have heard changes).

Git is written in C, shell scripts and Perl, and is scriptable; Mercurial is written in C (core, for performance) and Python, and provides API for extensions; Bazaar is written in Python, and provides API for extensions.


In considering each of them with one another and against version control systems like SVN and Perforce, what issues should be considered?

Version control systems like Subversion (SVN), Perforce, or ClearCase are centralized version control systems. Git, Mercurial, Bazaar (and also Darcs, Monotone and BitKeeper) are distributed version control systems. Distributed version control systems allow for much wider range of workflows. They allow to use "publish when ready". They have better support for branching and merging, and for branch-heavy workflows. You don't need to trust people with commit access to be able to get contributions from them in an easy way.


In planning a migration from SVN to one of these distributed version control systems, what factors would you consider?

One of factors you might want to consider is the support for inetracting with SVN; Git has git-svn, Bazaar has bzr-svn, and Mercurial has hgsubversion extension.

Disclaimer: I am Git user and small time contributor, and watch (and participate on) git mailing list. I know Mercurial and Bazaar only from their documentation, various discussion on IRC and mailing lists, and blog posts and articles comparing various version control systems (some of which are listed on GitComparison page on Git Wiki).

Jakub Narębski
FYI -- bzr-svn is far more capable than git-svn, in that it is bidirectional: I can run "bzr branch svn://...", and later merge my changes back to the svn server -- where they will be stored with metadata other bzr clients will recognize.
Charles Duffy
I'm a hg dev and I have been looking a bit at the Git design. I'm glad to see they both treat history in the only sensible way for a distributed setting: at a high level they are both an acyclic graph of commits and at a lower level they both let commits reference manifests which reference files (blobs in Git). Mercurial has anonymous branches (which, AFAIK does not exist in Git), it has bookmarked branches (very much like Git branches, but no push/pull) and it has named branches (branch name is recorded in commit -- those are also not in Git).
Martin Geisler
+2  A: 

A very important missing thing in bazaar is cp. You cannot have multiple files sharing the same history, as you have in SVN, see for example here and here. If you don't plan to use cp, bzr is a great (and very easy to use) replacement for svn.

Davide
This is missing by design -- cp cannot be added without creating a number of cases where it is difficult or impossible to be sure of doing the Right Thing on merging between a branch where a copy and changes happened and another branch with changes but no copy.
Charles Duffy
Sure, but it's something to be aware of - and it would be a very useful feature for many use cases (like splitting a file in two different ones and preserve history for both). Actually it is the only reason why I still use subversion for certain projects - where merging is irrelevant but copy is not
Davide
A: 

I was using Bazaar for a while which I liked a lot but it was only smaller projects and even then it was pretty slow. So easy to learn, but not super fast. It is very x-platform though.

I currently use Git which I like a lot since version 1.6 made it much more similar to other VCS in terms of the commands to use.

I think the main differences for my experience in using DVCS is this:

  1. Git has the most vibrant community and it's common to see articles about Git
  2. GitHub really rocks. Launchpad.net is ok, but nothing like the pleasure of Github
  3. The number of workflow tools for Git has been great. It's integrated all over the place. There are some for Bzr but not nearly as many or as well maintained.

In summary Bzr was great when I was cutting my teeth on DVCS but I'm now very happy with Git and Github.

sh1mmer
You mean "now" very happy, as opposed to "not" very happy, right?
Charles Duffy
Thanks Charles! Bit a Freudian slip there :)
sh1mmer
+1  A: 

There is good video by Linus Torvalds on git. He is creator of Git so this is what he promotes but in the video he explain what distributed SCMs are and why they are better then centralized ones. There is a good deal of comparing git (mercurial is considered to be OK) and cvs/svn/perforce. There are also questions from the audience regarding migration to distributed SCM.

I found this material enlightening and I am sold to distributed SCM. But despite Linus' efforts my choice is mercurial. The reason is bitbucket.org, I found it better (more generous) then github.

I need to say here a word of warning: Linus has quite aggressive style, I think he wants to be funny but I didn't laugh. Apart from that the video is great if you are new to distributed SCMs and think about move from SVN.

http://www.youtube.com/watch?v=4XpnKHJAok8

qKoder
+3  A: 

Take a look at the comparison made recently by the Python developers: http://wiki.python.org/moin/DvcsComparison. They chose Mercurial based on three important reasons:

The choice to go with Mercurial was made for three important reasons:

  • According to a small survey, Python developers are more interested in using Mercurial than in Bazaar or Git.
  • Mercurial is written in Python, which is congruent with the python-dev tendency to 'eat their own dogfood'.
  • Mercurial is significantly faster than bzr (it's slower than git, though by a much smaller difference).
  • Mercurial is easier to learn for SVN users than Bazaar.

(from http://www.python.org/dev/peps/pep-0374/)

Martin Geisler
Mozilla and Sun also uses Mercurial for the same reason.
jpartogi
bzr is also written in Python, is indeed slower than hg but by a quickly narrowing margin -- and as a user of both Bazaar and Mercurial, I /strongly/ disagree with the "easier to learn" assertion.
Charles Duffy
They are all still evolving. I decided on Bazaar for a DCVS to start with because I thought it was easiest (but not much in it) and Launchpad.net. It was quite slow. Git on OSX seems fine but poor Windows support. Since Python and Google projects have now adopted it, and because of TortoiseHg, I'm swapping to Mercurial. I think Mercurial is gaining a critical mass over Bazaar and will there. And Git will do its own thing, always focussed on Posix, so will never be truly dominant.
Nick
+7  A: 

Steve Streeting of the Ogre 3D project just (9/28/2009) published a blog entry on this topic where he does a great and even handed comparison of Git, Mercurial and Bazaar.

In the end he finds strengths and weaknesses with all three and no clear winner. On the plus side, he gives a great table to help you decide which to go with.

alt text

Its a short read and I highly recommend it.

Michael La Voie
Bazaar is NOT intuitive ))
gavenkoa