Skip to main content

When I first created PHPLOT I started with CVS. When I moved it to Sourceforge I converted to SVN. Now I'm using git and this guide is how to migrate from Sourceforge to Github or, in general, any SVN to git repository. 

1. Create the list of SVN Authors

Subversion only keeps the username for each commit. Git’s commits need to have a name and email listed at a minimum. By default git-svn  will just list the SVN username. This list can be used by git-svn to transform plain svn usernames into proper Git committers.

The format for a authors conversion file is

userabc = User UserLastname <userabc@example.com>

If you have a few users you can create this by hand or if there are many, in the root of your local Subversion checkout, run this command:

svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u | > authors-transform.txt

That will parse the log messages for the 2nd item (usernames), remove some whitespace, eliminate any duplicate usernames, sort the usernames &  a duplicate check for uniqueness (-u), and place them into a “authors-transform.txt” file.  

userabc = userabc <userabc>

into this:

userabc = User UserLastname <userabc@example.com>

2. Clone the Subversion repository using git-svn

git svn clone [SVN_repo_URL]  -A authors-transform.txt --stdlayout ~/temp_repo

If you get an error run "apt-get install git-svn" 

Check that it works by going to that new directory and looking to see if the logs are ok

cd ~/temp_repo
git log

3. Check to see if branch is named "master"

Run the following

git branch

And see if you get that you are in the master branch. 

You can now push to a repo

5. Define a remote repository

Your main development branch will be named “trunk” which matches the name it was in Subversion. You’ll want to rename it to Git’s standard “master” branch using:

git remote -v URL_OF_REPO origin master

6. Push

git push

 

 

Tags