How to change commit message in Git ?

sai7xp

Sumanth

Posted on March 17, 2021

How to change commit message in Git ?

Sometimes we need to change the git commit message which can be either pushed/not-pushed commit, here is how we can change the git commit message.

To change commits which are not pushed

git commit --amend
Enter fullscreen mode Exit fullscreen mode

commits which are already pushed

git commit --amend
git push origin master --force
Enter fullscreen mode Exit fullscreen mode

By using --force we can update our commit message on remote repo also

💖 💪 🙅 🚩
sai7xp
Sumanth

Posted on March 17, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related