We accidentally committed sha XXX to branch A instead of B.
A: VVV-WWW-XXX
B: VVV-WWW
So we'll follow the guidance on SO to move the commit from A to B:
git checkout B
git merge A
git checkout A
git reset --hard HEAD~1
git push --force
That will get us to:
A: VVV-WWW
B: VVV-WWW-XXX
If we then do commit YYY on branch A giving us:
A: VVV-WWW-YYY
B: VVV-WWW-XXX
And merge that into B will that cleanly merge YYY into B while not reverting XXX on B due to the fact that XXX was reset --hard
previously on A? What we'd want following the merge is:
A: VVV-WWW-YYY
B: VVV-WWW-XXX-YYY
I'm struggling with the affect of reset --hard
on the merging behavior. I think that reset wipes any history of the commit so the merge would just work without attempting to remove XXX from B.