SVN to GitHub Migration
This page explain steps required to migrate a project for SVN to GitHub.
Migrating a project from SVN to GitHub can be quite tricky especially if you want to maintain all the history, branches and tags. This guide assumes that once your project is migrated to GitHub you will be cut off from SVN and further commits on SVN won't be synced with GitHub repo. I found svn2git gem is the most convenient way to do get the job done. You might want to take a look at svn2git gem documentation.
Migrating a project from SVN to GitHub can be quite tricky especially if you want to maintain all the history, branches and tags. This guide assumes that once your project is migrated to GitHub you will be cut off from SVN and further commits on SVN won't be synced with GitHub repo. I found svn2git gem is the most convenient way to do get the job done. You might want to take a look at svn2git gem documentation.
- Make sure that you have 'ruby' installed on you machine. If not install it.
- Install svn2git gem
$ gem install svn2git - Create a directory where you want to checkout svn project to and cd into it
$ mkdir my_svn_project && cd my_svn_project - Checkout SVN project using svn2git
$ svn2git <svn_project_url>
Checkout time may vary depending upon number of branches and/or tags project has - Rmove remote references for branches and tags
$ git for-each-ref refs/remotes/tags | cut -d / -f 4- | grep -v @ | while read tagname; do git tag "$tagname" "tags/$tagname"; git branch -r -d "tags/$tagname"; done
$ git for-each-ref refs/remotes | cut -d / -f 3- | grep -v @ | while read branchname; do git branch "$branchname" "refs/remotes/$branchname"; git branch -r -d "$branchname"; done - Rmove unwanted branches
$ for branch in `git branch -a | grep "svn"`; do git branch -D $branch ; done - Create a repository on GitHub
- Add repo you created in step #2.1 above to the SVN project you checkout
$ git remote add upstream https://github.com/<organization>/<path_to_repo> - Push code to GitHub repo
$ git push -u upstream --all
$ git push -u upstream --tags
No comments:
Post a Comment