I started moving my open source code over to GitHub, since it supports working with contributors in a natural, but controlled manner. However, for many of my WordPress plugins I already have a local working copy, since they are hosted in the WordPress plugin repository to support auto-update. I didn’t want to disrupt my svn working copy, nor did I want to start fresh in github.
So this is how I did it:
- Create a new repos on github, and import the SVN repos from wp-plugins.org into github
- Move your local working copy to a new directory:
mv workingcopy/ workingcopy.svn/ - Clone your new github repos after the import is completed (which may take a while, since the plugin repos is shared by all plugins and has thousands of commits):
git clone git@github.com:user/repos.git - Once cloned, move the .git folder into your workingcopy.svn folder
- Then just ignore .svn folders with .gitignore and ignore .git with svn:ignore
- Now you can use git for your main development, and check tested changes into SVN to push your updates out to your Plugin users
There may be another way to go about this, but it wasn’t obvious to this hacker.
Very clever idea. But why did you need to move your workingcopy folder first?
By default the git clone wanted to take the same folder name as my existing working copy. I could have specified another name for it too, but sometimes I’m overly specific in my steps to keep all the moving parts straight in my head.