From: Dale R. Worley Date: Wed, 06 Mar 2013 18:55:20 GMT Subject: What I want rebase to do Message-ID: <201303061855.r26ItKtM018797@freeze.ariadne.com> In-Reply-To: <7vppzex2pq.fsf@alter.siamese.dyndns.org> 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