Distributed Version Control

by breeve 9. June 2010 15:59

It’s not that centralized version control is bad but rather it has a habit of getting in your way. Take creating branches. In Perforce, for example, creating a branch makes you feel more like being interrogated by the FBI than a developer wanting to set up a sandbox. Integrating and reverse integrating branches takes more work than necessary. It got so bad we abandoned branches.

A strategy of not branching—with one big trunk—may make merging a non issue but brings limitations. Complicated bug fixes that should be fixed in isolation are not an option. Instead, checkins like “bug fix part 1” and “bug fix part 2” are common leaving the trunk in a precarious state. Even worse, experiments are impossible to do in isolation discouraging innovative thinking.

Distributed version control got its start in the open source community where experimentation is essential. In distributed version control (DVCS) branching is a first class citizen. In fact, when the code is brought down locally from the server—called cloning in Mercurial—you have a copy of the entire repository. It is a self contained unit that doesn’t need to contact the server ever again. Checkins, diffs, reverts, and updating to earlier revisions all happen locally. If the server goes down, who cares?

While visions of developers being productive on airplanes, parks, or the local coffee shop brings a smile to every software manager’s face it isn't the real reason DVCS are becoming popular. Instead, it is the ease with which every developer gets their own sandbox. If the experiment goes bad simply delete the repository from the file system and start over. The server doesn’t have to know about your copy and no one is the wiser.

Not only can sandboxes be cleaned up easily but they can also be shared. Mercurial has a built in web server that allows changes to be pulled from your repository by others. This can be very handy when two or more developers are working on a feature and want to share unstable changes. No one outside this circle has to be bothered by changes going into the trunk just so they can reach a targeted subset.

If sharing repositories is easy then merging them must be a nightmare. But it turns out the most impressive feature of DVCS is the speed at which merges are done. Mercurial, for example, has a rename feature that automatically moves changes to the correct renamed files.

I started to experiment with Mercurial for my home projects and was impressed with its easy to learn command set and light weight feel. I was so impressed, I recommended we move to it at my new job. Other like minded developers I work with agree.



Powered by BlogEngine.NET
Theme by Mads Kristensen

About Me

I am a Principal Engineer with 16 years experience developing and releasing software products. I started developing in C/C++ then moved into .NET and C#. Currently working in Python/Flask and Docker. Have tech lead multiple projects. I have developed products in Windows Forms, ASP.NET/MVC, Silverlight, WPF, and Python. I currently reside in Austin, Texas.

Own Projects

Pickaxe - An easy to use web page scraper. If you know a little SQL and how basic CSS selectors work, no web scraping product will be easier to use.


FligthQuery - Query FlightAware FlightXml API with SQL


Created ASP.NET MVC forum originally targeting home owner associations but now in use by an investor group.


Currently Reading