Using Github with plugin SVN

Like this tutorial? Check out my updated and more comprehensive Git/Github/ tutorial at

I’m on a never-ending quest to come up with a good local environment that will support the kind of WordPress plugin development that I enjoy So Very Much. I’ve only just recently begun using Github for version control and already I can’t imagine living without it. But doing WP plugin development in Github is not totally straightforward, because’s plugin repository uses SVN. When it comes time to release a new version on the repo, it’s simply not practical to merge changes manually and manage two different version histories. I wanted a setup where I could use Github for everyday development, but would connect to WP SVN when I was ready to release.

There are lots of posts out there on how to use git-svn:

I couldn’t get any of the methods to work the way I wanted. But by mashing a few of them together, I have what is, I think, a workable setup. Here are the steps.

  1. If you don’t already have one, create a Github repository for your work. I’ll assume here that you have configured Git on your machine, with git-svn installed as well.
  2. Create a directory for your working copy. I use several local WP installations for plugin development, the main one of which is named Doris. So I’d do the following, for an imaginary plugin I’ll call awesome-plugin:
    	cd /sites/doris/wp-content/plugins
    	mkdir awesome-plugin
  3. Before connecting to WP SVN, it’s a good idea to check for the revision number of your most recent commit. If you don’t, git-svn will sift through all 280,000+ revisions on
    	svn log

    Scroll to find the most recent reversion number. Let’s say that in this case it’s r287228.

  4. Clone the svn repository to your newly created directory. Because I want this working copy to actually work as a WordPress plugin, I’m not going to check out the entire awesome-plugin tree. Instead, I’ll just get the trunk, and when I want to tag new versions of the plugin, I’ll do it in a separate working copy on my machine. (This is perhaps not the ideal way to work, but for me it works – probably irrationally, I like having “clean” instances of the trees somewhere on my machine that are used only for tagging new versions.)
    	git svn clone awesome-plugin -r287228

    git svn clone will create the git-svn link and then do the initial fetch into the awesome-plugin directory.

  5. Depending on how you’re planning to use Git, you might want to create a branch that tracks the svn trunk, just for stable svn releases:
    	cd awesome-plugin
    	git checkout -b svn remotes/git-svn
  6. Now that we’ve connected Git to WP SVN, we can connect to Github:
    	git remote add -f origin

    I’m calling Github ‘origin’ because I’m so used to push and pulling to and from ‘origin’, but you can call it whatever you want. Of course, make sure to change ‘boonebgorges/awesome-plugin.git’ to reflect your username and repo name.

  7. Let’s test the connections. If your Github repo is empty, you can push stuff up right away:
    	git push origin svn

    Remember that I am working on a branch called ‘svn’; you might use ‘master’ or something else altogether if you’d prefer. If your Github repo already had some files in it, you might find that you have to pull and merge them before pushing. Now make a change to your local:

    	touch test.txt
    	nano test.txt # Type something in the document and save it
    	git add .
    	git commit -m "testing git-svn"
    	git push origin svn
  8. Finally, let’s test to make sure that we can commit to SVN.
    	git svn dcommit

    The first time you try this, you will be prompted for your password. If your local username is not the same as your username (mine isn’t), just hit enter and SVN will ask for your full creds. You should get a “Committing to…” message, followed by “Committed r123456″ or something along those lines. You can check to see that your commit has gone through by visiting in your browser.

Good luck!

Using Github with plugin SVN by Boone Gorges, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.

11 thoughts on “Using Github with plugin SVN

  1. eins78

    “Because I want this working copy to actually work as a WordPress plugin, I’m not going to check out the entire awesome-plugin tree.”

    I am using just git, but there is another way to that regardless of the scm. Just create a symbolic link for the actual plugin folder in /trunk into your local wp install. I use in order to have all my repos in one folder and duplicates of working websites to work on in another location.

  2. Pingback: Tips and treats, no tricks around here: Friday Find « Premium BuddyPress Themes at BuddyDress

  3. Pingback: 15 Awesome Free Tools That Will Make Your WordPress Life So Much Easier | WordPress, Multisite and BuddyPress plugins, themes, news and help –

  4. Pingback: SFCite | Blog | 15 Awesome Free Tools That Will Make Your WordPress Life So Much Easier

  5. Pingback: Git to SVN: Automated WordPress Plugin Deployment | I Blog

  6. Pingback: Teleogistic / Revisiting Git, Github, and the plugin repository

  7. Pingback: Git to SVN: Automated WordPress Plugin Deployment | Website live in a day

  8. Pingback: Roundups here:

  9. Pingback: Moved my WordPress plugins to GitHub | Coen Jacobs

  10. Pingback: How to properly use Git with Subversion | danielbachhuber

Leave a Reply