Created
April 8, 2011 05:14
-
-
Save tony4d/909335 to your computer and use it in GitHub Desktop.
Migrate an svn repository to git and github
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assume your svn repo is located at svn://example.com/myapp/trunk | |
# Assume your git repo will be located at git@github.com:example/myapp.git | |
# First you need to generate a list of all committers in your svn tree. | |
# Credit David Wheeler | |
# http://www.justatheory.com/computers/tricks/list-all-svn-committers.html | |
$ svn log --quiet svn://example.com/myapp/trunk | grep '^r' | awk '{print $3}' | sort -u | |
# Next, create a file in your home directory named svn-committers following this format | |
mojombo = Tom Preston-Werner <tom@github.com> | |
defunkt = Chris Wanstrath <chris@wanstrath.com> | |
# Finally, do the migration | |
# Credit Jon Maddox for some of this | |
# http://www.jonmaddox.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/ | |
$ cd ~ && mkdir myapp-tmp && cd myapp-tmp | |
$ git svn init svn://example.com/myapp/trunk/ --no-metadata | |
$ git config svn.authorsfile ~/svn-committers | |
$ git svn fetch | |
$ cd .. | |
$ git clone myapp-tmp myapp | |
$ cd myapp | |
$ git remote set-url origin git@github.com:example/myapp.git | |
$ git push origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If, like me, you're trying to do this from a remote server with a large repo, you'll run into timeout problems. You have to do this locally.