HOWTO Convert SVN repository to GIT

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

One of these was cloning a SVN repository.  This topic can be used to convert a 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 onto SVN repository, with almost no effort.

Author file

We can translate commit authors by creating an ‘author files’.

Each row of this text file has the following format:

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

for example:

dude = The Dude <dude@ggogle.com>

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: https://regex101.com/

Print Friendly, PDF & Email