Tag Archives: svn

Clone a part of an SVN repository in git

I was trying to clone my wordpress plugin from the wordpress svn repo using git-svn. I had no luck for about the past 8 weeks, with this problem:

Initialized empty Git repository in /Users/lantrix/tweet/.git/
Using higher level of URL: http://plugins.svn.wordpress.org/tweet => http://plugins.svn.wordpress.org

And it would proceed to hit up the entire wordpress repo.
After reading a possible solution on Charlie’s Old blog, I stubmled across a newer way to do this.

As of v1.6.4 of git, you can now use a –no-minimize-url when doing a git-svn clone. This makes git clone only the part of the repo you want; and the added bonus is you can get all your tags and branches.

Here is how I did it:


git svn clone –prefix=svn/ –stdlayout \
–authors-file=authors.txt \
–no-minimize-url http://plugins.svn.wordpress.org/tweet/

It still took a while to parse all the SVN history, and now of course this stands out in the git-svn doco :-P

The authors.txt file just mapped my svn users to git user/email pair, e.g.:

lantrix = Lantrix <lantrix@somewhere.com>
plugin-master = none <none@none.com>
(no author) = none <none@none.com>

You will probably want to have a look at these set of scripts. Have a read of NothingMuch’s perl blog for extra steps and details on extra svn conversion scripts.