git rename commit

C++
git commit --amend -m "New commit message."git commit --amend -m "New commit message"$ git commit --amend -m "New and correct message"git commit --amend
git commit --amend
// press enter, editor would open# Displays a list of the last commits
# Just replace a name with another one and save and close the file
git rebase -i HEAD~3
Source

Also in C++: