My two cents to the previous answers: if
git push --force <remote> <the-hash>:<the remote branch>
still doesn't work, you might want to edit <your-remote-repo>.git/config
file's receive section:
[receive]
#denyNonFastforwards = true
denyNonFastforwards = false