Usually we want to clean up the commits before pushing the changes to remote.
But if we do need to change something on remote, we can use force push.
git push -f origin mater
NOTE: Really be careful when you force push a remote branch. Think twice if you really need to do that.
NOTE: Github provides a branch protection to prevent unintentional force pushing a remote branch.