[dev] Fwd: Rebase vs. Merge

Ben Klang ben at alkaloid.net
Wed Jan 13 18:08:30 UTC 2010


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.  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.  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.

I don't think the instructions above sufficiently cover remote-tracking branches, even though I can't explain why Git is complaining.  That was the reason I suggested the hack, but I'm hardly happy with the suggestion.  If someone can help me get Git to push my changes back to a remote branch after rebasing locally, I'll be happy.

/BAK/

-- 
Ben Klang
Alkaloid Networks LLC
ben at alkaloid.net
404.475.4850
http://projects.alkaloid.net




More information about the dev mailing list