First of all, retrieve the required package to enable the git svn command:
Standardise your SVN layout
If you're not using separate folders for tags and/or branches, you can just skip to the next setion.
As described in Bitbucket's SVN Tutorial, it's best to use a standardised configuration before starting the migration. Otherwise you'd have to manually change the config file to avoid errors during the last (cleanup) step. The ideal situation is to have a
tags layout. For example, I used the following commands:
Creating an authors file
If you want your commits to be assigned to the proper names, you can use Atlassian's Migration Script, or simply create the
authors.txt file with the following structure:
If you find this too much hassle, just leave the file and the
--authors-file argument away from the comments below.
Clone to Git
Then, the actual cloning to git. If you're using the standard layout as described above, you can simply use the
--stdlayout option, otherwise you have to specify trunks, branches and/or tags manually using the
Keep in mind the cloning process is aggressively — desperately — trying to find as much information as it can, which results in errors flying all around. The best suggestion I have is to simply see what the result looks like and change your parameters accordingly. For testing, you could specify a subset of revisions, for example:
Cleaning up Git
If you were using branches and/or tags in your svn repository, the resulting Git repository set these up a remote branches. If you plan on syncing your git repository back to svn, these remote branches help a lot and this section can be skipped.
Atlassian's tutorial suggests using a java-tool, but this tool isn't maintained anymore and therefore doesn't work as it should. So, we'll do it manually.
Using slightly modified commands from Sailmakers' great tutorial, we can manually make the remote branches and tags branches:
To check if all worked ok, use:
Adding Bitbucket as origin
Now to push it all to Bitbucket, first create a new GIT project on bitbucket.org and use the suggested commands below "I have an existing project", they'll look something like this:
Even though this process is quite cumbersome, it'll migrate your svn history to git, keeping all logs, branches and tags in tact. That said, getting the git svn clone commands set up properly can be quite cumbersome. Nonetheless, once you succeed, you can finally benefit of the — in my opinion — improved workflow git offers.