如何在RubyMine中更改过去的git commit + push消息?

问题描述:

我不小心给出了一个错误消息,并使用RubyMine推送了一个提交.有什么办法可以纠正它?最好使用RubyMine方式,不要弄乱git,但也欢迎其他受信任的方式.

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.

正如您所说,您已经推送了,因此最好不要更改提交消息.原因是提交将获得另一个哈希值,这使git认为您已经推送的提交与更改了提交消息的提交是不同的.那很不好!您可以使用git push -f强制推送,如果您是一个人工作绝对可以,但是如果您是团队工作,我建议您不要更改该提交消息.

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?