Skip to content

Change commit messages of unpushed commit in git

Learn how to modify/edit existing, unpushed commit messages in GIT. Find out how to change the commit message of the most recent commit.

We can use the –amend flag in git commit command to modify the commit messages.

Syntax

git commit --amend

Example

git commit --amend -m "New commit message"

Please make sure you don’t have any working copy changes staged before changing the commit message using the above command otherwise they will get committed too.

See also  How to rename an existing git remote ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.