Suppose we have the following situation in Git:
X---Y feature
/
A---B---C---D edge
Now I rebase the edge branch changing the B commit a little bit (using edit) so it now looks like this:
X---Y feature
A---E---C'---D' edge
C’ and D’ are the same commits as C and D, but applied on top of E (and notice that X within the feature branch became disconnected).
Now how can I:
- Rebase/merge the
featurebranch so that its commits appear as if they were applied on top of D’? - Rebase/merge the
featurebranch so that its commits appear as if they were applied on top of E, but without a separate ‘merging branch …’ commit (and with C’ and D’ being rewritten to become C” and D”)?
Xdoesn’t become disconnected per-se, it still has the originalBas its parent. If you want to subsequently rebasefeatureon top ofedge, then:If you wish to change the tree so that it has a similar structure to the original version, but with
Xas a child ofE, that’s: