Git rebase –onto to the rescue ( part 1 )

Posted: November 3rd, 2011 | Author: | Filed under: git | No Comments »

I am now using git since more than a year as my primary scm. I tend to use it also against svn repo,  I can so focusing on git  becoming always more comfortable using it.

To be honest up to now my git use has always been quite basic, while projects I was working on never needed more that a master/develop/topic branches workflow. Recently I faced a more complex issue related to the necessary  support for proper support branch that was going to diverge for a long time from the develop branch.

We have a develop branch where is done the job for new version 2.0 while we still have a stable branch where we support version 1.0. The issue comes from the fact that version 1.0 is not going to receive only simple hotfixes but will also be improved with new feature that need to be ported to version 2.0..

For the first month or so we still were able to merge the 2 branches but not they have diverged too much. Merge is not an option and so we had to find a new strategy.

Our goal was to carry all the changes made on a topic branch borned by the 2.0 branch into the same 2.0 and also to the 1.0 without merging 2.0 into 1.0. This can be solved cherry-picking any single commit from the topic branch to the 2.0 and then merge topic into 1.0. While this works fine we faced situations where the topic branch were actually getting too long and cherry picking many commits can be buggy and tricky.

Read the rest of this entry »