Premise
change last commit message
git-graph:
O target-commit that you want to change its message [df9c192]
|
O parent-commit [b7ec061]
|
O
Solution
git reset --soft b7ec061
git commit -m "new_commit_message"
git push -f
Explanation
- git reset --soft b7ec061 will keep your changes of files and reset to parent-commit (i.e. b7ec061)
- git commit -m "..." will locally create a new commit
- git push -f will push your new commit to the server and replace the old one (i.e. df9c192)