Subversion and Git

They usually don’t play nice with each other. But what if we need a plugin/repository available for git AND for svn?

The "new" way

It used to work – but since a few weeks it doesn’t anymore.
It WAS possible to checkout any github rep via SVN. Sounds crazy, but that was really working:[user]/[repository]
Anyway – doesn’t seem to be to stable, yet. So I don’t use this approach anymore.

The classic way

This works no matter what Subversion or Git do. It relies on the fact that they don’t get mixed up.
We exclude the .git and .svn dirs from each others rep.

Let’s say we already have our svn rep. We also want it to be in git.
We first create an empty git rep in the root folder of the rep: "Git Create Rep here".

I assume you already have the following excludes in your global svn settings (called "global ignore pattern"):
_* .git .gitignore
As you can see, i also like to exclude all tmp files (starting with _ like "_test.php").

Create a .svnignore file in the root folder of the rep:


We want to exclude tmp files as well as all svn related stuff.

Now add your files to git "master", commit them and synch with your newly created git rep. Usually the url is something like:
[email protected]:[user]/[repository].git

That’s it – your done!
They don’t interfere with each other. So there shouldn’t be any complications. Furthermore you can now chose which merging "engine" you want to use as they both work on the very same rep.

Live Example

Math Plugin: It is located in subversion (rep is not public, though) and in git. If I update the code, I just have to make sure, that i commit to both "sources". Otherwise one will be outdated.
Just to be sure you should consider ONE source the primary one. No matter what this should be the one to commit to, first.

0.00 avg. rating (0% score) - 0 votes

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.