You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adam Heath <do...@brainfood.com> on 2010/01/06 18:50:32 UTC

omg, more git magics

God, I just love git.  Just ran into another *wonderful* feature.

Here at brainfood, we use debian.  As such, we make use of the debian
packaging to deploy ofbiz to our servers.  To provide for that, I have
a branch of ofbiz that I made against head back in september, then I
cherry-pick patches from trunk as we see fit.

Yesterday, I was going thru all the changes in december,
cherry-picking several patches.  After I was all done, I then ran a
compile.  Wouldn't you know it, one of the changes didn't work.  This
was because it added a UtilValidate call, but not an import of
UtilValidate(most likely because some earlier commit that I didn't
cherry-pick already had added the import).  So, now I needed to fix
this problem.  The issue, is that the commit was *not* the last one,
but 9 commits old.  So, ...


git rebase -i HEAD~10, launches vim with:
==
pick 3373962 Remove duplicate webslinger-base-invoker libs ...
pick 7aee368 I noticed during test runs that the same eca ...
pick d3a6532 Merge birt branch 831204:886087 and 831209:885099. ...
pick ac2d9b6 Ignore birt/build
pick 897ffb2 Fix groovy class parsing/caching.
pick f64071b Although we do not experience compile problems ...
pick b7dc3d7 Applied patch from OFBIZ-3358, form ...
pick 181a272 too many files copied over from the addbirt ...
pick 35d9560 Utility methods for reading strings from streams ...
==

I then changed the second line to say 'edit' instead of 'pick', then
saved the file.

Git replayed all those changes to the 7aee368 commit, then told me to
edit any files I needed to.  I then ran git add to add them to the git
index.  git commit --amend altered the commit, allowing me to add the
missing import line.

Finally, git rebase --continue altered all the *other* commits that
sat on top of the broken one, optionally updating any patches that may
have merge conflicts(it's *very* smart at this).

So now I have a working tree, without this compile error, and the
proper fix is actually in the right commit, instead of being yet
another commit at the head.

This just makes me oh so happy.

Re: omg, more git magics

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
Adam - just wanted to say thanks for sharing all of these GIT goodies.  I'm looking forward to getting there ASAP as it really does sound like it fixes a lot of the problems that are all too common when doing distributed development like this.

Cheers,
Ruppert
--
Tim Ruppert
HotWax Media
http://www.hotwaxmedia.com

o:801.649.6594
f:801.649.6595

On Jan 6, 2010, at 10:50 AM, Adam Heath wrote:

> God, I just love git.  Just ran into another *wonderful* feature.
> 
> Here at brainfood, we use debian.  As such, we make use of the debian
> packaging to deploy ofbiz to our servers.  To provide for that, I have
> a branch of ofbiz that I made against head back in september, then I
> cherry-pick patches from trunk as we see fit.
> 
> Yesterday, I was going thru all the changes in december,
> cherry-picking several patches.  After I was all done, I then ran a
> compile.  Wouldn't you know it, one of the changes didn't work.  This
> was because it added a UtilValidate call, but not an import of
> UtilValidate(most likely because some earlier commit that I didn't
> cherry-pick already had added the import).  So, now I needed to fix
> this problem.  The issue, is that the commit was *not* the last one,
> but 9 commits old.  So, ...
> 
> 
> git rebase -i HEAD~10, launches vim with:
> ==
> pick 3373962 Remove duplicate webslinger-base-invoker libs ...
> pick 7aee368 I noticed during test runs that the same eca ...
> pick d3a6532 Merge birt branch 831204:886087 and 831209:885099. ...
> pick ac2d9b6 Ignore birt/build
> pick 897ffb2 Fix groovy class parsing/caching.
> pick f64071b Although we do not experience compile problems ...
> pick b7dc3d7 Applied patch from OFBIZ-3358, form ...
> pick 181a272 too many files copied over from the addbirt ...
> pick 35d9560 Utility methods for reading strings from streams ...
> ==
> 
> I then changed the second line to say 'edit' instead of 'pick', then
> saved the file.
> 
> Git replayed all those changes to the 7aee368 commit, then told me to
> edit any files I needed to.  I then ran git add to add them to the git
> index.  git commit --amend altered the commit, allowing me to add the
> missing import line.
> 
> Finally, git rebase --continue altered all the *other* commits that
> sat on top of the broken one, optionally updating any patches that may
> have merge conflicts(it's *very* smart at this).
> 
> So now I have a working tree, without this compile error, and the
> proper fix is actually in the right commit, instead of being yet
> another commit at the head.
> 
> This just makes me oh so happy.