如何使用 Intellij 编辑以前的 git commit 消息?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26636575/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I edit previous git commit messages using Intellij?
提问by eggbert
I want to edit previous commit messages, not just the last one. Can I do this using the rebase dialog in Intellij?
我想编辑以前的提交消息,而不仅仅是最后一个。我可以使用 Intellij 中的 rebase 对话框执行此操作吗?
回答by eggbert
I worked out how to do it but it seems long winded. Choose interactive rebase onto master, then 'edit' on the commit whose message you want to edit.
我想出了怎么做,但似乎冗长乏味。选择交互式 rebase 到 master,然后在要编辑其消息的提交上“编辑”。
This is where you should be able to amend a commit in the commit dialog, but you can't because there's nothing to commit.
So you have to go to the command line and do git commit --amend
, then git rebase --continue
.
这是您应该能够在提交对话框中修改提交的地方,但您不能,因为没有什么可提交的。因此,您必须转到命令行并执行git commit --amend
,然后git rebase --continue
。
Update: You can use 'reword' instead, see comments below.
更新:您可以改用“reword”,请参阅下面的评论。