I have a branch A in which I have made some changes a, and then I created a new branch B from A to continue to make some changes b, so that the total changes in B are a, b. Finally, someone else merged their changes c into master, so the work tree now looks like this:
- c (master)
\
- a (A) - b (B)
Then I rebased A to master, altering changes from a to a' and force pushed them to branch A, so the work tree looks like this:
- c (master) - a' (A)
\
- a - b (B)
The question
How can I rebase B to A, so that only the new changes b are altered and the work tree then looks like this:
- c (master) - a' (A) - b' (B)
If I try git rebase origin/A when I'm on B, then it tries to resolve commit a against c, a', which I don't want, since I fear it will create a new commit a'' and then the work tree will look like this:
- c (master) - a' (A) - a'' - b' (B)
Is there a way to only rebase change b now? (I have OFC tried to google this, but I didn't find anything to cover this case specifically)
EDIT:
I tried squashing a' and b on B, but that was even worse, because now all the changes from b were registered as conflicts. To illustrate, let's say that I:
- Added a new line
l1ina. - Changed that line to
l2inb. - This line was untouched in the other commit
c. - Now it is a conflict, because
l1was added ina', butl2was added in the quashed commita'&b.