Change git commit for remote (already pushed)

In order to change an already pushed commit, we can amend the last commit and then force push it, to override the remote.

git commit --amend -m "New commit message"
git push --force