How to change your commit messages in Git?
Case 1 : Not pushed + most recent commit:
git commit --amend
Case 2 : Already pushed + most recent commit:
git commit --amend
git push origin master --force
Case 3 : Not pushed + old commit:
git rebase -i HEAD~X
# X is the number of commits to go back
# Move to the line of your commit, change pick into edit,
# then change your commit message:
git commit --amend
# Finish the rebase with:
git rebase --continue
Case 4 : Already pushed + old commit:
Edit your message with the same 3 steps process as Case 3
(rebase -i, commit --amend, rebase --continue).
Then force push the commit:
git push origin master --force