If you want to change commit message after commit, you can do this by:
git rebase --interactive '^'
With this rebase you want edit your commit comment, after that commit your changes:
git commit --all --amend --no-edit
At last go on with your rebase to finish it:
git rebase --continue
To get back to the HEAD.
SHA-1 of the commit changes, so be creaful by pushing your commits. Don't use git push --fore
To avoid such mistakes there exist so called git hooks.
You have to implement a git hook to check commit message before the commit.
Go to .git/hooks folder in repository.
There is a file called „commit.msg.sample“ .
Remove „sample“ in the file name.
place shell script in file „commit.msg“ which checks the commit message.
Comments
If you want to change commit message after commit, you can do this by:
git rebase --interactive '^'
With this rebase you want edit your commit comment, after that commit your changes:
git commit --all --amend --no-edit
At last go on with your rebase to finish it:
git rebase --continue
To get back to the HEAD.
SHA-1 of the commit changes, so be creaful by pushing your commits. Don't use git push --fore