Benoit Daloze edited this page Jun 13, 2015 · 12 revisions
Clone this wiki locally

Ruby committer’s happy hacking life with github

Mise en place

% git clone git://
% cd ruby
% git svn init -s --prefix=origin/ svn+ssh://
% 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

% git svn init --prefix=origin/ -Ttrunk svn+ssh://
which will be a lot quicker.

Create a branch.

First take a look at

% git branch -r

and you will see many branches under origin/*. Of particular interest are 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

Here I chose origin/trunk for my feature’s upstream branch.

Enjoy your happy time.

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.

Push your changes into upstream repository.

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

The changes are now in the official svn repository!

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.

Another hack

Now go back to hacking. Enjoy!

Notes: deleting your local branch

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