A commit is not the HEAD now. and
git commit --amend will not work for it.
How to change its commit message?
You can use
git rebase together with
git commit --amend as follows. Assume your commit to be edited is
$ git rebase -i 2b8ed^
edit in the line contains 2b8ed.
Now, you have moved back to the commit before 2b8ed and you can do the commit message changing as before by:
$ git commit --amend
$ git rebase --continue
This command applies the following commits automatically to the original HEAD.
Be very careful when doing this if the commit has already been pushed to a git server and is shared with others. The others may need to rebase to get the changed history.
Note: read more about rewritting history in Pro Git.