This is my graph:
Branch A a-->b
|
v
Branch B b-->c
I have branch B that came out of branch A, from commit b.
I did a commit on branch B called c.
Now let's say I update commit b of branch A with git commit --amend to b'
Branch A a-->b'
|
v
Branch B b-->c
How do I update comit b on branch B to be the exact b' ?
Thanks
Actually, the grap is
a--b (A)
\
c (B)
After amend, you would have a new b' (marking b as tmp):
a--b' (A)
\
b--c (B)
(tmp)
You would need to rebase B onto A:
git rebase --onto A tmp B
a--b' (A)
\
c' (B)
As divyum comments, you can also merge, but that would add to A, and duplicate b commit between, resulting in possible conflicts:
a--b'--M (A)
\ /
b--c (B)
I prefer cherry-picking or rebasing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With