We decided to move bajos from github to googlecode at therefore I need to port our repo. The task import from git to svn could be done in this way:
Most of this is copied from the google page, but they are writing about continuous mirroring, I want to show, that the same procedure is useful for a one time import!
The Subversion repository must be nonempty. A new Google Code project contains one revision by default, but if you reset it, you should also create a first revision.
Naturally, your official source tree lives on some Git-capable server, which we denote by $GIT_REPO. http://code.google.com/hosting/createProject creating a new Google Code project, initialize an intermediary repository and fetch the Git tree:
$ git svn clone --username you https://your-project.googlecode.com/svn/
$ GIT_REPOfirstname.lastname@example.org:hwr-berlin/bajos.git #example!!! $ cd svn $ git fetch $GIT_REPO
Create a temporary branch for the fetched repository, and tag its head:
$ git branch tmp $(cut -b-40 .git/FETCH_HEAD) $ git tag -a -m "Last fetch" last tmp
Unfortunately, Git treats the initial commit specially, and in particular, cannot rebase it. Work around this as follows:
$ INIT_COMMIT=$(git log tmp --pretty=format:%H | tail -1) $ git checkout $INIT_COMMIT . $ git commit -C $INIT_COMMIT
Apply all the other commits to the temporary branch, and make it the new master branch:
$ git rebase master tmp # takes a while $ git branch -M tmp master
Lastly, commit the changes to Google Code:
$ git svn dcommit # depending on your repo size it could be a run some hours
I had problems during the dcommit because of some bug on googlecode. My commit cancels at some point. If you have the same problems check:
I need to do it several times.
Important you need the last hash (HEAD) from your git repo!!!