Until recently I was using the official WordPress repository’s svn to do the development. All my non-WordPress pet projects are hosted in my github account.
I was thinking of moving all my WordPress Plugins to github for quite sometime now, but didn’t do it thinking that it might involve huge effort to keep both the repos in sync.
After reading about how a couple of people moved (and didn’t face much problem afterwards), I decided to try it out for a couple of my Plugins. The following is what I did and in the end, figured out that it was worth the effort.
Github – more than just code
To be fair to official WordPress Plugin repository, there is nothing anything wrong with the way it works or with svn.
It is just that github as a platform is more suited if you are interested in collaboration and receiving contributions from users. It reduces the barrier to entry for people to contribute to projects and also it provides enough tools for project owners to easily merge (or reject) contributions from users.
I was more interested in this aspect of github rather than the ‘git’ part.
Using github for hosting WordPress Plugins
When I decided to move from svn to github, I wanted to do the following things.
- I wanted to maintain the entire check-in history from svn. Some of my Plugins are more than 4 years old and have gone through lot of revisions and I didn’t wanted to loose them.
- I also wanted to do the development in github (read doing atomic check-ins) and then upload to WordPress repository only when I tag the changes for release after testing them.
- I also didn’t wanted to manually check-in in both the places to do the sync.
For the first I found that
git-svn can fetch all the check-in history.
For the second and third point, keeping pragmatism in mind, I ended up creating shell scripts so that I don’t have to do anything manual.
You can get the scripts that I wrote from my github account. The project consists of two scripts.
- clone-from-svn-to-git.sh – Use this script to clone your WordPress Plugins from SVN into git/github
- deploy-plugin.sh – Use this script to push your WordPress Plugin updates to SVN from gi/github
Right now the documentation is pretty sparse. I will fix it when I get some free time
Things to improve
The scripts pretty much do the job. Going forward, I want to improve the following to make it more useful.
readme.txtfile used by WordPress repository is not fully in markdown. Because of which the readme file displayed in github is slightly broken.
Ability to auto update the
.potfile before releasing the new version
WordPress repository allows you to add a banner using the
assests/directory. Need to add support for that.
Update: All the above features are added. Check out the latest code in github.
Is it worth the effort?
So far I have moved the following Plugins to github. Will be moving the other ones as well when even I get some free time.
- Bulk Delete
- Bulk Move
- WP IRC
- WP Github Commits
- WP Plugin Reviews
- WP Year end stats
- Posts By Tag
- Email Log
- Twitter Avatar Reloaded
So now the real question. Is it worth the effort? It is worth every second that I spent on it.
You should check the pull requests I have received so far. I have received more contributions to my Plugins in the last couple of weeks than the last 5 years
If you are a WordPress Plugin developer, then try out my script and let me know if you have any feedback.