CARVIEW |
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 (they won’t be imported over). If you only have a trunk, like many svn repositories, 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
You can pull in later commits by running git-svn rebase
from within your repo. (If you ever lose your local copy, just run the import again with the same settings, and you’ll get another working directory with all the necessary SVN metainfo.).
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
Other guides
- Guide by Jon Maddox (doesn’t deal with branches)
- Guide by Bob McWhirter (doesn’t deal with branches)
- Guide by Yuval Kogman