If that bad code is the result of one or several commits, use git revert
to cancel them locally.
That will create a new commit cancelling the bad code, and you can push that commit.
Given one or more existing commits, revert the changes that the related patches introduce, and record some new commits that record them
Pushing that revert commit to GitHub will trigger the post-receive hook and pull that new change into production.