Use the reset subcommand:
git checkout A
git reset --hard B
git push --force github
As a sidenote, you should be careful when using git reset while a branch has been pushed elsewhere already. This may cause trouble to those who have already checked out your changes.