How to change commit message after pushed to remote in Git

Viewed 19248

I added wrong commit message and pushed to server in Gitlab. Now I want to change commit message. Is it possible to change commit message after pushed to server?

1 Answers

git commit --amend

When you run this command, it will ask you to change the commit message in a file. After changing it, make sure you push into the correct branch with the following command.

git push -f origin "your branch"

Edit commit message without opening a file:

git commit --amend -m "Your new commit message"

Related