Saturday, August 03, 2013

Cool Tools: Distributed Source Control Systems (git + hg)

I assume you're already using version control: svn, cvs, or if you work at microsoft source depot (sd)

Summary
If you don't know what git/github are, go download and start using it.  If you use hg and bitbucket, sigh, and switch to git/github.

What is DCVS?
Distributed Version Control Systems (DVCS) are version control systems (VCS) that don't rely on a single central server.  DVCS is designed so multiple people can check in independently while offline and then merge their changes together.

In DVCS systems everyone has a copy of the entire version control repository (repo), instead of just having a version of all the files .  Because you have the entire repo, you can check in at will, and when it's time to collaborate you can push your changes into someone elses repo.

A common question when VCS people come to DVCS is if you're distributed how do you know the version that should ship? Turns out even though everyone has their own repo, there is still a central repo that represents the truth.  Read  Joel to learn more.

The two major DCVS systems,  Git and Hg:
Today there are two competing DCVS systems  git and hg. Git is written by "C" developers,  and hg is written by python people.  The philosophy of these language permeates into these tools.  Hg, like python is "batteries included",  simple, easy to use, hard to get wrong. On the other hand git, like C, is "a fast car with no seatbelts". Fast, powerful, and easy to get wrong.

A few years ago, it wasn't clear which of hg or git would dominate the industry. Sadly today it's obvious git won, and hg will go the way of python - awesome tool, reasonable support, and interop with other systems, but ignored by the enterprise.  While git, like "C" is known and used by everyone.

So, if you're a normal developer, skip hg and use git.

Where to host the central server, GitHub and BitBucket:
As I said in the introduction, even with a DCVS you still tend to use a central server to host the repo of truth.  To meet this need both hg and git have a defacto standard code hosting company. For git, it's github, and for hg it's bitbucket.  Github is the better, and probably one of the contributing factors to the success of git.

Fighting the system, using hg with git:
Now, if you're the kind of developer who uses python for fun, I have a different recommendation. Learn git, just like you know C, but also learn hg. Use hg-git so you can use the hg tool chain on top of git repositories. This lets you interact with the git masses while getting all the benefits of hg.


No comments: