If you want your branch B look exactly like branch A You can simply do a reset --hard
git checkout branch-B git reset
Be careful, you will lose fixation in this case. Your branch-B will look exactly like branch-A, any commits that were made for branch-B that were not in branch-A will be lost . In addition, if branch-B is shared with other people, it is not recommended to perform this operation.
In this case, you can try to return those commits that are not needed in branch-B
git revert <sha-of-"some other commit"> git revert <sha-of-"merge of other stuff from branch C (into branch B)">
The second commit looks like a merge commit, so you might have to pass in the parent as well.
git revert <sha-of-"merge of other stuff from branch C (into branch B)"> -m1
pratZ
source share