A Reason to Stick with Subversion instead of Git

So, all the hype seems to be why you should switch to Git instead of SVN, and there are a LOT of reasons to switch to Git: It’s Distributed, it’s reportedly up to 30x lighter weight, easier branching/merging, etc. However, today I came across a reason to stick with Subversion, and that is: Sub-directory branching.

So, let’s say that you’re a small webshop and you have a custom CMS that you use for all your sites, but you also do some WordPress and BrochureWare sites that have some common files (e.g. CSS reset files, particular folder structure you want all your people to use, etc.). To simplify your life, you want this all under a single source control repository so that you can “branch” your templates for every website, and your structure looks something like this:

/Templates/CustomCMS
/Templates/WordPressTemplate
/Templates/BrochureWareTemplate
/Sites/WordPressImplementation
/Sites/BrochureImplementation
/Sites/CustomCMSImplementation

You can basically think of this as having 3 trunk/master folders in a single repository. With subversion this is extremely easy because every folder is essentially it’s own little repository. When you’re creating a new custom CMS site, you just branch the /Templates/CustomCMS/ to your Sites/SiteName folder and start working on it. If you find a bug in the custom CMS and fix it, you can merge it back up into your /Templates/CustomCMS folder. When you’re checking out code, you can also check out just a sub-directory rather than having to checkout the entire repository. With Git, this isn’t so easy. A Branch in Git is a branch of the ENTIRE repository. There are some tools for bringing external repositories into a subtree of a Git repository, but still not for branching off of that directory only. So, for similar functionality to the above folder layout, you’d have to have 3 separate repositories with Git.

For larger projects, where you only want a single repository for the entire project, Git seems to win out for me. However, for these much smaller projects that can kind of all be lumped together easily in a single repository in Subversion, Subversion is the winner.

Advertisement

About Kevin K. Nelson
I am a business owner/programmer by trade, but my heart is in teaching and writing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.