This is how I see what rebase should do: The simple case for rebase starts from P---Q---R---S master \ A---B---C topic Then "git checkout topic ; git rebase master" will change it to P---Q---R---S master \ A'--B'--C' topic A' is created by a three-way merge that can be symbolized Q-->S | | v v A-->A' That is, Q, applying the changes from Q to A and the changes from Q to S, becomes A'. After that A-->A' | | v v B-->B' | | v v C-->C' A more complex case is when there is a merge from an external source P---Q---R---S master \ A---M---C topic / ---X We want to produce P---Q---R---S master \ A'--M'--C' topic / ---X So we have to merge Q-->S | | v v A-->A' | | v v M-->M' | | v v C-->C' Any "evil" changes in M will be in the changes A->M (along with the changes introduced from X), and so they will be reincorporated in A'->M'. M' lists A' and X as its parents. (And not M!) If there is an internal merge in the topic branch, things look like this P---Q---R---S master \ \ B \ / \ A M---D topic \ / C and we want to produce this P---Q---R---S master \ \ B' \ / \ A' M'--D' topic \ / C' Which can be done with these merges Q-->S | | v v A-->A' A-->A' | | | | v v v v B-->B' C-->C' There are two choices for constructing M' (which ought to produce the same results under ordinary circumstances) B-->B' C-->C' | | | | v v v v M-->M' M-->M' and finally M-->M' | | v v D-->D' Dale -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html