I like writing WordPress plugins and I like using git to version-control them. Problem is that wordpress.org uses svn. Even worse, I like to use git submodules, so git-svn is not an option.

What to do? Write a shell script, of course.

In my home directory, I have a git folder and an svn folder, which contain repositories:

|- git/
| |+ front-end-editor/
| |+ posts-to-posts/
|- svn/
| |- front-end-editor/
| | |+ branches/
| | |+ tags/
| | |+ trunk/
| |- posts-to-posts/
| | |+ branches/
| | |+ tags/
| | |+ trunk/

As you can see, the names are the same. This simplifies things a lot.

Now on to the script:

A few things to note:

When you delete a file in git, it will also be deleted in svn.

In your git repo, you can create a .svnignore file where you can add paths that you don’t want to show up in your svn repo.

It doesn’t mirror commits, just files. The git repo is the authoritative source.

Example usage:

cd ~/git/front-end-editor/

# make some changes ...

git ci -m "add shiny new feature" -a


That’s it.

PS: I also have a script on top of that which handles tagging: