Changing a git commit message after I have pushed it to the server?

How to change a wrong git commit message after I have pushed it to the server?

asked May 14, 2014 by Eric Z Ma (44,280 points)

1 Answer

 
Best answer

If the remote repository is shared with others, it is better to let the wrong git commit message there.

If you use the repository by your own and you are sure that no one else has pulled your latest commit:

First, change the local commit message:

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

Then, force pushing again:

git push -f

Again, this operation is dangerous. Do it only if you know what you are doing.

answered May 14, 2014 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...