How to maintain and update your free hosted plugin using Git

Chances are you are using git to develop your plugins, but are forced to learn (and remember) all those SVN commends every time you want to make a change. Using this method you can use git for the majority of your source code control while only pulling in your changes using git when you need to push an update to your users.

This method is using Terminal on MacOSX, instructions should be similar on Windows/Linux.

Initial Setup

Step 1: Clone the SVN repo locally

If you haven’t already you’ll want to follow these instructions to get a copy of the SVN repository cloned on your local machine, and a trunk directory created.

Step 2: Create a Git repository where you’re doing your plugin development

You’ll likely do this right within the wp-content/plugins/<your plugin> folder on your local machine where you have your local copy of WordPress installed, using something like VVV.

cd wp-content/plugins/<your plugin>
git init
git add *
git commit

Then create an account and push your repo up to GitHub, bitbucket, or similar service.  It’ll be a git push <something> with that something varying depending on the service.

Step 3: Clone your Git repository to the SVN trunk folder


cd <your SVN folder>
mv trunk trunk-backup
git checkout <your git repo url> trunk

to checkout the git repository into trunk.  This way you can just pull your changes from git into your svn trunk folder.

Common Tasks

Releasing a new version

If you have a new version of the plugin ready to go, first git commit and git push the changes up to your report Git repository.  Be sure to update your plugin’s header and your readme.txt with the new version and stable tag.


cd <your svn folder>/trunk
git pull
svn status
svn add <any files you have added since the last time you did an update>
svn ci -m 'your message for the new version'

which will pull your changes from Git, then commit and update your changes to the SVN.  Lastly you’ll want to tag your new version:

cd ..
svn cp trunk tags/<your new version>
svn ci -m 'tagging version x.y'

This will copy your trunk to a tag and push it up to

Updating Your Readme.txt

Often you just want to update some of the copy in your readme.txt rather than releasing a new version.  Just do that with:

cd <your svn folder>/trunk
git pull
svn ci -m 'updating readme copy' readme.txt
cd ..
cp trunk/readme.txt tags/<your current version>
svn ci -m 'updating readme copy in current version' tags/<your current version>/readme.txt

This will pull the changes to your readme.txt and push it up to SVN.

Updating SVN Development Version

If you want to push people to the ‘development’ tab on your plugin, just do the same steps but avoid creating a tag or updating the ‘stable tag’ version in your readme.txt:

cd <your svn folder>/trunk
git pull
svn status
svn add <any files you have added>
svn ci -m 'updating development version'

Other Options

There is a script, another that’s GitHub specific, and even a grunt task version which will do a lot of the above for you, but it’ll usually create a new tag and re-checkout the SVN repository each time you want to update. There’s also a new service if you’re on github that seems to do everything you need without SVN.

I’m looking at creating a git hook where you would just type something like:

git push production master

to push your new version to your local machine, which would then run the above SVN commands. I started this at the last WordCamp USA but haven’t finished a way to only update your readme.txt, which is a pretty common use case.  Feel free to star/watch the github repo to be updated when I’m able to finish that off or let me know if you’d like to help!

Stop putting off launching your plugin.

Check out my course, Making Pro Plugins!