Git vs Mercurial

From WikiVS, the open comparison website

Jump to: navigation, search


Git and Mercurial are the two most popular Distributed Version Control Systems (DVCS).

Contents

[edit] Design

Mercurial is claimed to be simpler and easier to learn than Git. However, Git is more flexible and powerful. Git provides more lower-level commands than Mercurial, allowing virtually direct access into the inner workings of the repository. Even so, many of the same things are achievable with both.

[edit] Commands

Git Mercurial
git pull hg fetch (Requires the FetchExtension to be enabled.)
git fetch hg pull
git reset --hard hg revert -a --no-backup
git revert <commit> hg backout <cset>
git add <new_file> hg add <new_file> (Only equivalent when <new_file> is not tracked.)
git add <file> Not necessary in Mercurial.
git add -i hg record (Requires the RecordExtension to be enabled.)
git commit --amend hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip (Requires the MqExtension.)
git blame hg blame or hg annotate
git bisect hg bisect
git rebase --interactive hg histedit <base cset> (Requires the HisteditExtension.)
git stash hg shelve (Requires the ShelveExtension or the AtticExtension.)
git merge hg merge
git cherry-pick <commit> hg import - (Transplant requires the TransplantExtension.)
git rebase <upstream> hg rebase -d <cset> (Requires the RebaseExtension.)
git format-patch <commits> and git send-mail hg email -r <csets> (Requires the PatchbombExtension.)
git am <mbox> hg mimport -m <mbox> (Requires the MboxExtension and the MqExtension. Imports patches to mq.)
? ? ? hg update

[edit] Performance

Git is faster than Mercurial on Linux systems.

[edit] Philosophy

Git is based on the Unix philosophy of having one application provide one functionality. Git used to consist of 144 executable files that each do a certain job within a Git repository.

Mercurial, on the other hand, is one binary executable.

[edit] Licensing

Both Git and Mercurial are open-source projects.

[edit] Hosting Provider Support

Sometimes developers find it useful to outsource management of their revision control systems. With distributed version control systems, of course, there is no need for a centralized repository, however the option to ignore the presence of a central repository does not negate the usefulness to selectively embrace centralization.

Here is a listing of hosting providers, whether they support Git, Mercurial, or both, whether their services are free to FOSS projects, and whether they accept payments for proprietary projects.

Provider Git Mercurial Free hosting Premium hosting
GitHub x x x
Google Code x x ?
BitBucket x x ?
SourceForge x x x ?
Kenai x x x

[edit] Development

Git is written mainly in C. Mercurial is written in Python.

Git was created by Linus Torvalds for the purpose of maintaining the Linux source code repository.

[edit] Popularity

Git started its popularity by becoming the official version control system for the Linux Kernel. Even apart from the Linux Kernel, Git is quickly becoming popular among open-source hackers, and has already shown extreme popularity among Ruby programmers. Most Ruby projects are maintained in Git rather than in Mercurial.

The Python language's development has now been moved to Mercurial, and many projects written in Python are switching to it as well. Mozilla is now also using Mercurial for its various projects [1].

[edit] Links

See Also the Following Articles

Personal tools
Related Ads