[hibernate-dev] Applying commits from 3.6 to master

Steve Ebersole steve at hibernate.org
Mon Nov 1 17:02:04 EDT 2010


This morning I had a bug fix from an IRC discussion and decided to use it to 
try this stuff out.  I chose to work on this on a topic branch created from 
master.  I ran into worse trouble than you had :)

About 6 hours on #git helped me get a working answer, though not any better 
understanding.  The basic steps in the process were:
1) create a backport branch from the original feature branch.
2) use rebase -i to perform the actual backport
3) merge to the target branch

My complete workflow was as follows:
1) Create the topic branch:
git checkout -b HHH-5706-lob-offset

2) Do my work

3) Commit work to the topic branch
git commit ...

4) Create a backport branch
git checkout -b HHH-5706-lob-offset-backport HHH-5706-lob-offset

5) Git rebase changes to backport branch
git rebase --onto 3.6 master

6) Git merge the backport to the 3.6 branch
git checkout 3.6
git merge HHH-5706-lob-offset-backport

7) Git merge topic branch to master
git checkout master
git merge HHH-5706-lob-offset

8) Push changes
git push

9) Clean up
git branch -d HHH-5706-lob-offset
git branch -d HHH-5706-lob-offset-backport


Lot of work.  Lot of the folks on #git seemed to empathize that this is a bit 
more convoluted than it might should be.

Another option I was looking at with them keeping along the lines of separate 
clones for work on the 3.6 and master branches was to use refs (origin for 
example) between the local 3.6 and master clones.  In fact you can clone one 
to the other locally!





On Friday, October 29, 2010, at 01:19 pm, Adam Warski wrote:
> I'll report the first time I'll have to do that.
> 
> Adam
> 
> On Oct 29, 2010, at 8:11 PM, Steve Ebersole wrote:
> > Curious what happens if you go the other direction (imho the more natural
> > direction)?  Working from master to the 3.6 branch...
> > 
> > On Friday, October 29, 2010, at 01:02 pm, Adam Warski wrote:
> >> After some tries, here's my workflow for applying commits from the 3.6
> >> branch to the master branch: 1. Commit to 3.6 :)
> >> 2. Create patches for the commits using git format-patch commit
> >> sha/range etc. This will produce numbered patches. 3. Switch to master
> >> 4. Modify the patches using the following script:
> >> 
> >> #!/bin/bash
> >> for file in $*
> >> do
> >> 
> >>        sed 's/\/envers\//\/hibernate-envers\//' < $file > mod_$file
> >> 
> >> done
> >> 
> >> (substitute envers with the appropriate module)
> >> 
> >> 5. Apply the patches using git am <file>
> >> 6. Done
> >> 
> >> Not very straightforward, but works. And maybe somebody will find a
> >> better way :)
> > 
> > ---
> > Steve Ebersole <steve at hibernate.org>
> > http://hibernate.org

---
Steve Ebersole <steve at hibernate.org>
http://hibernate.org



More information about the hibernate-dev mailing list