How do I go about adding and committing these changes to branch B?
It all depends if you already committed the changes. Since you didn't commit the changes yet a git checkout should do the trick.
git checkout