You can also use:
git rebase -i HEAD^
This will open your text editor and allow you to change the last message. You need to replace the word pick at the beginning of the line with reword , save the file and exit. After that, a new text editor will open that allows you to change the commit message.
This sounds a bit more than the proposed git commit --amend , but it also works for older commits. Therefore, if you find that you want to change two messages in the last ten commits, you can run git rebase -i HEAD~10 and change the word pick to reword and change both of these messages.
Just for the curious: -i means interactive reboot.
source share