How to use git plugins in your subversion rails project

If you like me still use subversion for your own rails projects but you want to use all the latest and coolest rails plugins that are hosted in a git repository you need to do as follows.

Start with installing git. If you use OS X you can download an installer here.

After you’ve done that use the following line to clone the remote git repository in your local vendor/plugins directory.

git clone --depth 1 git://github.com/fauna/has_many_polymorphs.git vendor/plugins/has_many_polymorphs

Change the address to the git repository and the name of the directory under vendor/plugins to fit your needs. In the above example I got the has_many_polymorphs plugin from github.

The checked out directory can then be added to your subversion repository like all other files. If you later want to update the plugin all you have to do is enter the directory and execute.

git pull

This ‘Using Git like svn:externals’ article helped me figure this out.