[Git] Change the commit message of my last commit
Did you make a typo in your last commit message? No problem, we can use the git --amend
command to change it very easily. Note: This only holds if you did not yet push your changes to the remote repository
git commit --amend
It open the REPL let you to modify the last commit message.
We shouldn't change the commit message from the remote repo, it break other prople commit logs
--amend can be used in another case, which you forgot to save one file, but you already did one commit, in this case, you might want to add this file into previous commit as well instead of creating a new commit.
all you need to do is:
// save the file git add . // do the commit with amend git commit -amend // in the popup REPL,you can modify the previous commit message or just keep it and continue