In some cases, we want to overwrite branch A with branch B, especially when there are too many conflicts after long time working or someone's code has ruined the branch A. Here is the method:
// firstly, checkout to branch A
git checkout branchA
// then reset origin
git reset --hard origin/branchB
// push to remote forcefully
git push -f
So simple, now BranchA is clean again.