Friday, October 30, 2009

Peaceful Co-Existence Between Subversion and Git

So I have been using Subversion as my source control tool for my Rails apps for a couple of years now, and I am very happy with it.

Recently, I have begun to use Git as my source control for plugin development, and using as a means to share my work with the community.

So, the dual-tool strategy begs the questions:

  • Do they play nice together?

  • How does a developer make them play nicely with one another?

The short answers to these questions is Yes. If you want the details, read on.

Given the Tidy code I am versioning using Git is not a full-blown application, I need it to reside within the context of a Rails application to test it. So this is what I did:

  1. Have my application, let's call it X, version controlled using Subversion

  2. In application X's vendor/plugins directory, I create a Git repository called tidy; this is where I maintain and test Tidy's code

  3. This Git repository is tied to, so that I can push any changes out for the community to see

  4. The tidy directory is also version controlled by Subversion, so that my application has a working copy of Tidy that I can deploy

  5. However, Subversion complains about the tidy/.git directory, and Git in turn complains about the various tidy/*/.svn directories

  6. To remedy this, I added a tidy/.gitignore file to ignore the various tidy/*/.svn directories, and I added set the svn:ignore property on tidy/ to ignore the tidy/.git directory

With this setup, I can now more easily maintain the code for both my Rails application and the Tidy plugin.

No comments: