Git and Mercurial are both free software tools for distributed revision control and software source code management.
Both Git and Mercurial were started at approximately the same time with similar aims. The immediate stimulus was the announcement in April 2005 by Bitmover that they were withdrawing the free version of BitKeeper, which had been used for the version control requirements of the Linux kernel project. Mercurial creator Matt Mackall decided to write a distributed version control system as a replacement for use with the Linux kernel. Mackall first announced Mercurial on April 19, 2005.
Git was created by Linus Torvalds for Linux kernel development, with an emphasis on being fast. The development of Git began on April 3, 2005. The project was announced on April 6, and became self-hosting as of April 7. The first merge of multiple branches was done on April 18.
The Linux kernel project decided to use Git rather than Mercurial, but Mercurial is now used by many other projects.
Mercurial's major design goals include high performance, scalability, being a serverless, fully distributed collaborative development, robust handling of both plain text and binary files, and advanced branching and merging capabilities, while remaining conceptually simple. It includes an integrated web interface.
One of Linus Torvalds' key design goals for Git was speed and efficiency of operations. Other design criteria included strong safeguards against corruption, either accidental or malicious.
Projects using Git vs Projects using Mercurial
Several high-profile software projects now use Git for revision control, most notably the Linux kernel, Perl, Samba, X.org Server, Qt (toolkit), One Laptop per Child (OLPC) core development, Ruby on Rails web framework, VLC, YUI, Merb, Wine, SWI Prolog, GNOME, GStreamer, DragonFly BSD and the Android mobile platform.
Projects using Mercurial include Adblock Plus, Aldrin, Audacious, Dovecot IMAP server, GNU Octave, NxOS, Nuxeo, Growl, MoinMoin wiki software, Mozilla, Mutt (email client), Netbeans (IDE), OpenJDK, Python, SAGE, Sun Microsystem's OpenSolaris and Oracle's Opensource Software like Btrfs.
Git vs Mercurial Portability
Mercurial was initially written to run on Linux. It has been ported to Windows, Mac OS X, and most other Unix-like systems. Mercurial is primarily a command line program.
Git is primarily developed on Linux, but can be used on other Unix-like operating systems including BSD and Solaris.
Git also runs on Windows. There are two variants:
- A native Microsoft Windows port, called msysgit is approaching completion. As of February 2009, there are downloadable installers ready for testing Some commands are not yet available from the GUIs, and must be invoked from the command line.
- Git also runs on top of Cygwin (a POSIX emulation layer), although it is noticeably slower, especially for commands written as shell scripts.
User Interface for Git vs Mercurial
All of Mercurial's operations are invoked as keyword options to its driver program hg, a reference to the chemical symbol of the element mercury. GUI interfaces for Mercurial include Hgk (Tcl/Tk). This is implemented as a Mercurial extension, and is part of the official version. This viewer displays the directed acyclic graph of the changesets of a Mercurial repository. This viewer can be invoked via the command 'hg view', if the extension is enabled. hgk was originally based on a similar tool for git called gitk. There is hgk replacement named hgview that is written in pure python and provides both gtk and qt interfaces.
Related Mercurial tools include:
- Related tools for merging include (h)gct (Qt) and Meld.
- The convert extension allows import from CVS, Darcs, git, GNU Arch, Monotone and Subversion repositories.
- Netbeans IDE supports Mercurial from Version 6.
- Tortoise Hg provides a Windows user-friendly, right-click menu interface.
- VisualHG is an Mercurial source control provider plugin for MS Visual Studio 2008.
- Mercurial Eclipse is an Eclipse team provider plugin for Eclipse 3.3 and newer.
Alternatives for running Git using a GUI include:
- git-cvsserver (which emulates a CVS server, allowing use of Windows CVS clients)
- Eclipse IDE-based Git client, based on a pure Java implementation of Git's internals: egit
- NetBeans IDE support for Git is under development.
- A Windows Explorer extension (a TortoiseCVS/TortoiseSVN-lookalike) was started at TortoiseGit and Git Extensions which is an explorer extension as well as a standalone GUI and a Visual Studio 2008 Plug-in