The reason why B would need to pull in A's changes before he (or she) can push their own changes to that same branch, is that otherwise B would be rewriting history (removing A's commits in favor of their own), and A's commits (which are not part of B's local branch) would be lost.
This is only the case if you push to the same branch, so yes, B could push to another branch without having to pull A's commits first. In that case, the merging of A's and B's commits will take place later, when their branches are merged.
If you do want to push to the remote branch even though it contains commits that are not in your local branch, you can instruct git not to warn you and to continue with the push anyway, using git push --force
(or git push -f
). However, be careful, as in most cases (especially when you're working together with other people) it is not advisable to do so. The commits that are not in your local branch, will be removed from the remote branch.