Really, you will need just a few commands to run.
First of all you need to make a clone of Subversion repository using git-svn tool:
$ git svn clone --authors-file=authors.txt https://example/svn/MyRepo/trunk/project project
On this command git will go through the history of the project and fetch it into local git repository. If your subversion repository is using standard layout (i.e. trunk, branches and tags paths are present in the SVN repository root tree) than you may be interesting in
--stdlayout
option. You may also specify custom path for trunk or branches or tags using -T
or -t
or -b
option respectively.Option
--authors-file
contains the path to the file with committers mapping.This file contains SVN committer mapping to git user per line.
For example:
ruslan = Ruslan <ruslan@example.com>
john = John Smith <john@smith.com>
So now you have local working copy that is managed by Git and also you have all project history in your local repository. It's easy to check what branches and tags you have using next commands:
$ cd project
$ git branches
$ git tag -l
If you have remote Git repository (maybe in GitHub), than you may want to push source code with all history to that repository. And it is not a problem, as you have already everything you need.
1. So add remote repository:
$ git remote add origin git@github.com:myname/myproject.git
2. And push to the remote repository:
$ git push origin master
3. and be happy - now you have migrated to the git repository.
Remove directory with SVN repository clone and make another clone but from git repository and continue using it:
$ cd ..
$ rm -rf project
$ mkdir project
$ cd project
$ git init
$ git remote add origin git@github.com:myname/myproject.git
$ git pull origin master
Thats how it worked for me 2 months ago.
No comments:
Post a Comment