Skip to content

Instantly share code, notes, and snippets.

@latentflip
Created March 24, 2011 10:21
Show Gist options
  • Save latentflip/884843 to your computer and use it in GitHub Desktop.
Save latentflip/884843 to your computer and use it in GitHub Desktop.
I decide to work on a new feature, so I create a branch, topic.
o---o master
\
o---o---o---o topic
I am not yet finished working on my feature when I have to make some bugfixes to master
o---o---o---o master
\
o---o---o---o topic
To help me continue working on topic, I would like the bugfixes to be included in the topic branch.
Do I?
Merge master into topic (or) Rebase topic onto master
o---o-----------o---o master o---o---o---o master
\ \ \
o---o---o---o---o topic o---o---o---o---o topic
What do you think?
@latentflip
Copy link
Author

For reference, responses on twitter so far:

@sneeu: I’d rebase, I think it looks tidier than a lot of merges.

@paulanthonywils: Rebase, which keeps your local branch an ancestor of the current dev.

@Moggy: I'd merge into topic at that point so there's a clear history of what happened. But that's just me.

@roryf: I would always rebase, fewer log messages and less chance of conflicts when you do merge to master

@_Spakman: I'd rebase. You had based your topic work on master by branching. You are now re-basing your work on master after the fixes.

@relativesanity: as a recovering rebaser, rebasing is fine if you don't care about remembering where who branched what. Big team = merge it

@lenary
Copy link

lenary commented Mar 24, 2011

rebase, every time!

@KidkArolis
Copy link

I remember reading about the possible dangers of rebase, but can't quite remember what exactly those were =)
I think you shouldn't rebase if you push that branch to other repos

It's mentioned a little bit here for example:
"Perhaps the worst problem with traditional rebasing is that it prevents collaboration. Somebody who pulls from a repository before and after a rebasing will experience conflicts because the two histories contradict each other. Thus the standard caveat "don't rebase within a published repository", which can be reworded to "don't collaborate on work that you might later want to rebase"."
http://softwareswirl.blogspot.com/2009/04/truce-in-merge-vs-rebase-war.html

@lenary
Copy link

lenary commented Mar 24, 2011

yeah, basically, if you've pushed that branch and others may have pulled it, don't rebase, otherwise (usually locally), you're fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment