[jboss-dev] Porting SVN Projects to Git

Andrew Lee Rubinger andrew.rubinger at redhat.com
Wed Jul 14 12:40:17 EDT 2010


Today I look a relatively simple project and migrated it from SVN to 
Git.  There's a bunch of resources scattered about involving the "best" 
way to do this, but thought I'd share my experience as it appears to 
have been a success.  If anyone's got a better process I'm interested, too.

Note: I'm on Fedora13, so some commands here are gonna be env-specific.

# Obtain dependencies which run or are run from the svn2git Ruby script
$> sudo yum -y install git-core git-svn ruby rubygems
(Original instructions used apt-get, so I assume Debianey/Ubuntooey 
distros support this command too)

# Install the svn2git gem (script)
$> sudo gem install svn2git --source http://gemcutter.org

# Make a new directory to contain your new local Git repo and switch into it
$> mkdir jboss-ejb3-async; cd jboss-ejb3-async

# (Optional) Create a mapping file from SVN usernames to Git Authors
$> svn log | grep -E "r[0-9]+ \| [a-z]+ \|" | awk '{print $3}' | sort | 
uniq # Prints out all authors for the current SVN working copy
File format should be:
SVNUsername = Full Name <email.address.org>
ALRubinger = Andrew Lee Rubinger <alr at jboss.org>

# Use svn2git to extract out the SVN commit information, passing along 
parameters to note trunk, tags, branches locations
$> svn2git https://svn.jboss.org/repos/jbossas/ --trunk 
projects/ejb3/components/async/trunk --tags 
projects/ejb3/components/async/tags --nobranches --authors ../authors.txt
(More info on the switches at: http://github.com/nirvdrum/svn2git)

# Create a remote repo somewhere (I did GitHub and used the web console 
for that)

# Add a remote "origin" to the local repo so we can push to it
$> git remote add origin git at github.com:ALRubinger/jboss-ejb3-async.git

# Push all contents including the tags to the origin at branch master
$> git push --tags origin master

S,
ALR


More information about the jboss-development mailing list