How to modify the last commit message?

Modify the last commit message in the local copy

There are cases when you must alter the last commit message. This can be done by typing the following command in the command line:

git commit --amend -m "My awesome new message" 

Modify the last commit message in the remote repository

First, you must modify the local commit message, as it is described in the previous section. Next, you can push the local state of the branch to the remote repository.

git push --force origin <branch_name>


The video below demonstrates the described commands above:

Leave a Reply