[dev] Fwd: Rebase vs. Merge

Michael Rubinsky mrubinsk at horde.org
Wed Jan 13 18:23:33 UTC 2010


Quoting Ben Klang <ben at alkaloid.net>:

> On Jan 13, 2010, at 12:50 PM, Michael M Slusarz wrote:
>>>>
>>
>> Again, agree with Mike R.  I personally want my topic branches to  
>> only contain the differences to master.  And every local topic  
>> branch I create, I always do a 'git rebase master' whenever I come  
>> back to it to ensure that whatever changes I make going forward in  
>> the topic branch will be able to be cleanly applied to master.
> <snip>
>>>>
>>>> I think that:
>>>>
>>>> git rebase origin/master
>>>> git pull --rebase
>>>> git push
>>>>
>>>> should work for remote branches, then when it's time to merge into master:
>>>>
>>>> git checkout master
>>>> git merge [topic]
>>>> git pull --rebase
>>>> git push
>>>>
>>>> should work.
>>
>> This all sounds good to me.  I would vote for putting up these  
>> instructions on horde.org Git page.
> As long as we're talking only about local branches, I think we are  
> all in agreement.  The above instructions work great, and it's what  
> I do for local branches.
>
> My concern comes from multiple developers working on remote  
> branches, in this case the branch remote living on dev.horde.org.  I  
> agree with what you said above that "I want my topic branches to  
> only contain the differences to master."  My question is how to go  
> about doing that with a remote tracking branch.

This should work fine with a remote tracking branch, and in fact is  
what I've been doing with the ActiveSync branch currently in horde-git  
and (in limbo) in horde-hatchery.

In my experimentation so far,
> I've found that performing a rebase to master on a remote-tracking  
> branch makes me unable to push the branch back upstream.

What errors have you been getting from git when it refuses the push?

The only
> way I've found to update my remote-tracking branch has been to merge  
> from master, but obviously that leaves me with a messy history.

Shouldn't be necessary, and in fact will probably cause you many  
headaches when you merge your topic branch into master. Maybe try the  
whole process from the start, with a brand new topic branch, to be  
sure there is not something funny going on locally with your existing  
topic branch? This has been working for me perfectly (so far,  
anyway...knock on wood).

Thanks,
mike

--
The Horde Project (www.horde.org)
mrubinsk at horde.org

"Time just hates me. That's why it made me an adult." - Josh Joplin


More information about the dev mailing list