Rename A Git Commit Message
To rename the last commit message simply use the following Git command:
git --amend -m"The new commit message."
To rename a previous commit message that isn’t the last commit:
-
-
- Type the following command:
git rebase -i HEAD~n
, where n is the number of commits to list, this should include the commit you want to change. - Locate the commit you want to edit and change the first word from pick to reword, then save the file and exit.
- The commit you want to edit should immediately open where you can change the message on the first line. Then save the file.
- Lastly push the commit with
git push -f
.
- Type the following command:
-