WordPress Plugins : Git, GitHub and Subversion Workflow

Our release of our Stop Web Crawlers WordPress Plug-in,  is now available on the WordPress.org plug-in directory,  the initial release of the code to the directory presented us with an interesting challenge of integrating tow different Source Code Version Control Repositories.

Our internally we primarily  use Git and public GitHub repositories for  Stop Web Crawlers plugin version control. However WordPress.org make use of Subversion to manage the release versions of plugins.

The WordPress Plug-ins Directory is a hosting site, not a listing site. We didn’t really want to switch to Subversion internally just to support all the future WordPress Plug-ins.

We wanted to make use of our Git and GitHub repositories but still only publish new versions of our plug-ins once they are ready for release to the WordPress Plug-in Directory.  Fortunately, after thankfully finding Ben Lobaugh’s blog post this easy enough to implement.  The following can be used as a guide to provide you with the basics for you to develop further.

Linux and Mac

We make use of Linux or Mac OSX to do all of our development, so the instructions below are most suited to these environments.

If you’re running Mac OSX you may want to install the HomeBrew package manager

Install HomeBrew on Mac

Install Git and Subversion

To ensure you have both Git and Subversion installed your system, you can simply install them using the following terminal commands.

Ubuntu

Mac OSX

Create .gitignore and .svnignore files

You may not want to exclude some files from each of the repositories. i.e.  Your eclipse build folders and README.md file from your Subversion repositories.  Our bet practice is create gitignore files and subversion ignore files to exclude any files we don’t want to share.

The process may change a little depending on where in the Software Development Lifecyle you’re in. So for instance if you’re just starting out you may want to create your GitHub repository, or if you’re wokring off a mature GitHub repository you may just want to clone it

Create GitHub Repository

You may want initially create your GitHub repository using the initialize the Git repository on your local machine and configure the remote for you GitHub and commit and push your files.

Clone exisitng Git Hub Repo

Clone using SSH

Clone using HTTPS

When your repository cloning is complete. You will need to change directory into your working directory

Set up a Subversion tracking branch

We will create a branch that will only be used for keeping track of the changes between the two repositories.  You will never carry out any software development directly on this branch. We will only be making use of Git’s merging capabilities to merge and publish our changes on this branch to our subversion repository.

Daily Development operations

Once this is all set up, we can now continue with a daily operations, adding new features and fixing bugs etc. Once we’re ready to update the release on subversion we simply, need to merge our subversion branch and development branch.

Merge changes from subversion to Github

 

Merges changes from Github and publish to subversion

 

Follow Me

Gary Woodfine

Helps businesses by improving their technical proficiencies and eliminating waste from the software development pipelines.

A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.
Follow Me

Latest posts by Gary Woodfine (see all)

π
%d bloggers like this: