How to change a past git commit+push message in RubyMine?

Davit picture Davit · Apr 7, 2013 · Viewed 25k times · Source

I accidentally gave a wrong message and pushed a commit with it using RubyMine. Is there any way I can correct it? RubyMine way would be preferred not to mess up git, but other trusted ways are also welcome.

Answer

Max Beikirch picture Max Beikirch · Apr 7, 2013

As you said, you already pushed, so it's wise not to change the commit message. The reason for that is that the commit will get another hash which makes git think that the commit you already pushed and the commit whose commit message you changed are different. That is bad! You can force push with git push -f and that's absolutely okay if you are working alone, but if you are working in team, I suggest you not to change that commit message.

For anything else, take a look here: How to modify existing, unpushed commits?