Let's say I have the following tree:
A -- B -- C -- D -- E main
\
F -- G -- H featureA
\
I featureB
I'm working off featureA
and want to update to latest main
.
If I git checkout featureA
followed by git rebase main
, it does not bring featureB
branch along with it.
Here is what I want:
A -- B -- C -- D -- E main
\
F' -- G' -- H' featureA
\
I' featureB
Let's say I have the following tree:
A -- B -- C -- D -- E main
\
F -- G -- H featureA
\
I featureB
I'm working off featureA
and want to update to latest main
.
If I git checkout featureA
followed by git rebase main
, it does not bring featureB
branch along with it.
Here is what I want:
A -- B -- C -- D -- E main
\
F' -- G' -- H' featureA
\
I' featureB
That has to be done by hand:
git rebase main featureA
git rebase G festureB --onto G'
You could use the old commit ID of featureA
(that is, before it was rebased) instead of G
in the second command or you could create a temporary branch where featureA
is before the rebase so that you can use that branch after featureA
is rebased.
featureA
frommain
, then rebasefeatureB
fromfeatureA
? – esqew Commented Jan 6 at 23:44featureA
, make a temporary merge offeatureB
(just-s ours
), thengit rebase --update-ref --rebase-merges main
, then reset back to delete the temporary merge. This way you get both refs in the same rebase operation. I’m pretty sure that Johannes Sixt (j6t) has an answer like that somewhere but I wasn’t able to find it. – Guildenstern Commented Jan 7 at 17:28