GitHub’s instructions for doing this:
- On the command line, navigate to the repository that contains the commit you want to amend.
- Type
git commit --amend
and press Enter. - In your text editor, edit the commit message and save the commit.
- Use the
git push --force origin example-branch
command to force push over the old commit.
Source: https://help.github.com/articles/changing-a-commit-message/