CARVIEW |
ATTN: Rackspace Move Scheduled for Sunday, September 27th at 5PM Pacific Time. Learn More.
Guides: Import from Subversion
Let GitHub do it for you
GitHub can directly import SVN projects. All you’ll need is the repository URL. More details are in the blog article that introduced the feature. Note: GitHub does not keep imported projects synchronized with the SVN repo.
Do it yourself
svn2git
svn2git is designed to provide a complete svn import. Unlike git-svn, it will create proper git tags from your svn “tags”. Note: The current version of svn2git has GitHub support removed.
git-svn
git-svn can be used to import as well. Note that there may be issues if you have branches or tags. If you only have a trunk, like many svn users, this method should work for you without issue.
First, be sure to create your repository on github
$ git svn clone -s SVN_REPO_URL LOCAL_DIR $ cd LOCAL_DIR $ git remote add origin git@github.com:GITHUB_USERNAME/REPO_NAME.git $ git push origin master
Note that the -s switch implies that your svn repo is set up with the standard branches / tags / trunk structure.
git-svn adds a note to every commit message it copies over from svn. To get rid of that note, add --no-metadata
to the git svn clone command
Author mapping
When migrating a Subversion repository to Git, you can map the Subversion users to Git users. You have to create an authors file which contains the mappings:
fesplugas = Francesc Esplugas <fesplugas@intra….bles.net>
Then clone the subversion repository with the previously created authors-file
:
$ git svn —authors-file=/home/fesplugas/.authors clone svn://intraducibles.net/var/svn/rails/plugins/something_fu something_fu