Git, Svn, Rails, Edge and Plugins
Setting up a Rails Project that is kept under svn and uses svn:externals for plugins for use locally with Git
Currently git
doesn’t support repositories within repositories. This becomes
a problem when we are working with Rails projects that use plugins linked
externally. If you are just using subversion you’d generally manage plugins
using svn:externals
or Piston
if you’re wise. There is a tool called
Giston, which addresses that problem in the Git world. Unfortunately I
couldn’t get that to work.
Using symlinks
The solution I’m using combines two solutions from
The technique is to use symlinks from your projects vendor library to seperate
Git repositories of Rails and the plugins you are using. Sanity, Inc
provides a GIT repository of the Rails SVN repository at
git://git.sanityinc.com/rails.git
. Creating this probably took days, but now
its done, its very small (9MB) and quick to download.
Now you can link from your project to this repository.
cd myrailsproj/vendor ln -s pathToSanityRailsGit rails
The fact that you can change which version of rails you are working against in just a few seconds is very cool e.g.
# In Git Repository for Rails git checkout -b 2-0-stable origin/2-0-stable
will change you to stable Rails2. Use git-branch -a
to see whats available.