Re: Pulling one commit at a time.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 24 August 2009 08:22:07 Sanjiv Gupta wrote:

> > In general the public history isn't necessarily a single straight line
> > like this picture and it doesn't make sense to merge one at a time for
> > all the commits on the public branch, but if that is what you really want
> > to do, you can do so.
>
> Excellent description. Thanks for that. I want to merge commits one by
> one because I want to run a regression suite on each commit and
> therefore know if any one is causing failures.

What I do for a case like this is using rebase. I'm not sure if I get the 
explanation right enough to please all the git gurus on the list, but I'll 
try. What this basically does is to back out all the commits you did on your 
branch to the point you diverged from the branch you're rebasing on now.

So assuming you had a structure like this:

           your 'master' HEAD
             |
     A---B---C
    /
---X---U---V---W---Y
                   |
                public 'master' HEAD

git would back out commits A-C, so your local branch HEAD would be at X. Then, 
if forwards your branch to the branch you're rebasing on, so your local 
branch HEAD is at Y now, like the public branch HEAD.

After that, git applies all of your patches back to your local branch, 
producing a tree that looks like this:

                           your 'master' HEAD
                             |
                     A---B---C
                    /
---X---U---V---W---Y
                   |
              public 'master' head

Personally I prefer that solution as it keeps the history linear. Of course 
this means that all of your commits change sha1s, and you should not do this 
on public branches with tags. But if you're still developing, it's much 
easier to wrap your head around a history like this. It's also nice to 
present feature branches to other people, as all of your commits are in one 
block, without lots of annoying merge commits between them.

rebase also handles more complicated cases of merging, but from the way I 
understood your issue, this should already help.

Cheers,
Kai
-- 
Kai Blin
WorldForge developer  http://www.worldforge.org/
Wine developer        http://wiki.winehq.org/KaiBlin
Samba team member     http://www.samba.org/samba/team/
--
Will code for cotton.

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]