Rename A Git Commit Message

less than 1 minute read

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:

      1. 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.
      2. Locate the commit you want to edit and change the first word from pick to reword, then save the file and exit.
      3. The commit you want to edit should immediately open where you can change the message on the first line. Then save the file.
      4. Lastly push the commit with git push -f .