% git clone git://github.com/ruby/ruby.git % cd ruby % git svn init -s --prefix=origin/ svn+ssh://firstname.lastname@example.org/ruby % git svn fetch
This might take quite a while (YMMV). Take a cup of coffee. Or three.
After that, your repository behaves as if you converted ci-repository directly into git.
If you need to commit only to trunk, you can replace the
git svn init line above by
which will be a lot quicker.
% git svn init --prefix=origin/ -Ttrunk svn+ssh://email@example.com/ruby
First take a look at
% git branch -r
origin/trunk(head of Ruby 1.9.x) and
origin/ruby_1_8(head of Ruby 1.8.x). Choose the appropriate branch for your hack and make a local branch from that:
% git checkout -b my_feature origin/trunk
origin/trunkfor my feature’s upstream branch.
You can use git normally, including creating other branches, merging, etc… You are a committer so I do not explain this stage since you probably know how.
Once you are sure you should apply your changes worldwide, begin with:
% git svn rebase
This will bring your branch up to date with the upstream svn repository and rebase your changes. After fixing any conflicts you may commit your changes with:
% git svn dcommit
You can notice with
git log that git svn has appended to your commits a line with a “git-svn-id” that shows the svn revision number.
Now go back to hacking. Enjoy!
Your local branch may be deleted after you have merged it into upstream repository. But you should not be on that branch when you delete that.
% git checkout trunk
% git branch -d my_feature