I began using Git last year and have enjoyed it so much that I'm considering switching over my largest, most active Subversion repo. Unfortunately, that repo contains several (related, but independant) projects.
There are many, many pages describing how to convert a single-project repo, but far fewer for multi-project repos. In fact, I've only found a few, and they all seem to assume that each project has its own trunk:
project1/
branches/
tags/
trunk/
project2/
branches/
tags/
trunk/
project3/
branches/
tags/
trunk/
Regrettably, my Subversion repo looks something like this:
branches/
*empty*
tags/
project1-0.9/
project1-1.0/
project1-1.0.1/
project2-0.9/
project2-0.9.1/
project3-0.5/
trunk/
project1/
project2/
project3/
Worse, the tags are all created from the working copy (e.g. svn copy . svn://example.com/svn/tags/project1-1.0.2
), so include small changes never commited to the trunk (mostly hard-coding version numbers). Also, there are a handful of commits which span all projects (license updates, etc.). Thankfully, at least, there are no merges!
Is there a clean way to untangle these projects while keeping my tags? If it helps, this would be a one-way conversion, with the Subversion repo taken offline afterward.
The goal of this step is to convert the source Subversion repository to a local bare Git repository. A bare Git repository does not have a local working checkout of files that can be changed, instead it only contains the repository's history and the metadata about the repository itself.
If you still want to migrate existing branches, run the following PowerShell command: This command can take a few minutes to several hours depending on the size of the SVN repository. Upon completion, you will have a Git checkout of your repository.
Push the local Git repository to a remote Git repository hosted on Azure Repos Lock SVN repository, synchronize any remaining changes from SVN repository to local Git repository and push final changes to the remote Git repository on Azure Repos
The high-level workflow for migrating from SVN to Git is as follows: Prepare a migration environment Convert the source SVN repository to a local Git repository (Optional) Synchronize the local Git repository with any changes from SVN repository while developers continue using SVN
I used http://gitorious.org/svn2git/svn2git to do the very same thing. This tool was originally created to convert the huge KDE SVN repository to Git, which BTW is also laid out as your repository. All you have to do is writing a simple control file describing which directories correspond to which project and branch. In the end you have a nice set of git repositories for your projects.
One note though: There is no direct support for SVN tags. You will have to import them as Git branches and postprocess them, cf. http://gitorious.org/svn2git/svn2git/blobs/master/samples/merged-branches-tags.rules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With