I want to change the Git commit message for the previous commit

Viewed 13240

I want to change a previous pushed commit message. Also, I have pushed other commits after that. If I change the commit message will older message be shown in Git commit history.

4 Answers

To change the commit message when cherry-picking, use “git cherry-pick” with the “-e” option.

$ git cherry-pick -e <hash>

As illustrated in this example, your default editor will open and it will let you change the commit message.

enter image description here

When you are satisfied with the edits, save your file and your commit message should be saved successfully.

Related