Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change commit message after pushed to remote in Git [duplicate]

Tags:

git

github

gitlab

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?

like image 907
Gobind Avatar asked Dec 11 '22 05:12

Gobind


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"

like image 118
Mythili Avatar answered Dec 21 '22 17:12

Mythili