HOWTO Convert SVN repository to GIT

In my previous post, I wrote about using GIT with an SVN server pathing across different processes.

One of these was cloning an SVN repository.  This topic can be used to convert an SVN repository to GIT one with all its revision history.

The Process

We can use the cloning command to set up the starting revision of our new GIT clone, by the following command line:

git svn clone -r<starting_revision>:<ending_revision> --username="<svn_username>" "<full_svn_url>"

where <ending_revision> is usually set to HEAD.

The final result is that our Git repository has stored all the revisions from our starting point to now.

By using this process, it is possible to split only one folder/project into an SVN repository, with almost no effort.

Author file

We can translate commit authors by creating a dedicated file.

Each row of this text file has the following format:

<username> = <name> <<email>>

for example:

dude = The Dude <>

and add the following parameter to the cloning command line

--author-file <filename>

Including/Excluding folders

You can also include folders by this parameter:

--include-path <regex-string>

or exclude them by:

--exclude-path <regex-string>

To build a regex string, this site can help: