Solitude is great - if you are a wild beast or a god.
Francis Bacon

July 11, 2013

Version Control Software

Long ago I used rcs and cvs, then I moved on to svn, and just when I am looking into git, along comes mercurial.

What is the best version control system?

The answer is simple, it is git. If that simple answer doesn't satisfy you, feel free to read the rest of this page.

The question of "which version control software is best?" is right up there with "What is art?" and "Is vim better than emacs?". Actually these days it boils down to Git versus Mercurial. Everyone has forgotten about SCCS and RCS (or should have). CVS was fine until SVN came along. SVN was the hot fish up till about 2005 or so, but is now clearly fading into the gloom.

This leaves us with Git or Mercurial. You can find intelligent people favoring either one and giving good reasons why they feel the way they do. Git has an impressive track record and I have found no reason to use Mercurial instead, so I am going with git.

If you want to, you can read about some of the pros and cons in these articles:

There is also now something called "bazaar" or maybe it is "bizarre". I am biased against it because it is yet another doggone version control system clamoring for our attention. Just say no! Ignore it. No doubt somebody somewhere, right now is writing yet another piece of version control software. And more people are lining up behind those people.

GIT

GIT is the 900 pound gorilla of version control. It was written by Linus to support linux kernel development. It has over 100 commands, and complexity is probably the leading reason more people do not use it. It turns out this is a bad reason, but keep reading.

Git makes two big advances over SVN:

In 2011 I began fiddling with GIT. I have found that it is actually quite reasonable to deal with. A small set of commands do everything that I want. I have tested the claim that branching actually works, and found it to be true. So far I am very impressed.

Take a look at this analysis of GIT and Mercurial done by Google in 2008.

To learn git:

Here is a partial "cheat sheet" showing command equivalents (more or less).

Subversion (SVN)

Mercurial (Hg)

Git

svn add hg add git add
svn blame hg blame git blame
svn cat hg cat git show
svn checkout hg clone git clone
svn commit hg commit ; hg push git commit -a ; git push
svn delete/remove hg remove git rm
svn diff hg diff git diff, git diff –cached
svn help hg help git help
svn log hg log git log
svn revert hg revert git checkout -f
svn status hg status git status
svn update hg pull –update git pull
svn move/rename hg move/rename git mv

There are people out there who claim that you should never use git pull, but always first fetch, then merge. I blindly followed this advice for a while, but now I just pull and am lazy and happy.

RCS and CVS

Nobody uses CVS or RCS anymore. At least nobody (except an idiot) would use these systems by choice for a new project. Anybody inheriting some old project using these would convert them to git or mercurial and would curse the lazy slob who had not already done the conversion.

I will ashamedly admit that I have some projects still under CVS.

SVN

In comparison to CVS, using SVN is like stepping into the 20th century. But not the 21st century, you need git or mercurial for that.

For simple linear workflows with one developer, SVN is fine, and as a bonus it will handle binary files (but don't try to merge changes). In fact whatever you do, do not try to branch and merge with SVN, you will deeply regret it.

Here is my set of notes about how to use SVN.

Mercurial

Given the existence of GIT, I don't know why we have mercurial (never mind Bazaar). The feature sets are virtually identical, although people do make big issues out of what seem to me to be esoteric issues.

Like GIT, mercurial is a distributed version control system (DVCS) and has a branch and merge system that works.

Mercurial is written in python, which is neither here nor there unless you are crazy enough to want to modify it or write extensions.

To learn Mercurial:

I cannot recommend the mercurial tutorial too much, even if you intend to use GIT instead of mercurial. The first section (Subversion Re-education) is invaluable for an old Subversion hack like myself.

TRAC

TRAC is not a version control system. It likes to call itself a "project management system". We have used it as a web interface on top of SVN. It has many features (like bug tracking) that we never use. What we do like is the ability to have a web view of files in an SVN repository. What we do not like is that TRAC lured us into placing all of our projects into a single shared repository.

I have a set of notes about working with TRAC which you might find useful.

TRAC is strongly SVN oriented, although there are GIT and mercurial plugins. There are probably better web front ends to a git repository such as Cgit or redmine. There are even plugins for using multiple mercurial repositories inside of Trac, which makes me happy.

Bazaar

This is yet another version control system that has its origins in the Ubuntu project. It does not seem to be gaining much momentum. (And why do we need yet another version control system??). It could be the greatest thing on earth, I don't know, and am busy enough looking at mercurial and git to care.

Here is an article you can read.:


Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org