我总是使用 git commit --verbose
。当我在 git rebase --interactive
期间重写提交消息时,是否有等效的选项/设置可以让 git 显示差异?
最佳答案
根据您在评论中的回答,执行 git diff HEAD^
对您没有帮助,除非您只想重新编写最后一次提交。
但在这种情况下,rebase 无论如何都是错误的工具。相反,您可以简单地执行 git commit --amend --verbose
而不更改索引,然后编辑提交消息,获得您要求的差异 View 。
如果你想用 diff View 改写旧的或多个提交消息,只需使用 edit
节而不是 reword
节,然后使用 git commit --amend --verbose
每次提交的索引中都没有代码更改。
reword
应该只是使用 edit
的快捷方式,然后在不做任何更改的情况下执行 git commit --amend -m "new message"
这只会更改提交消息。
您还可以将 git commit --amend --verbose
或 git commit --verbose
定义为别名,这样您就可以节省一些输入,并且可以 e. G。只需执行 git cav
或 git c --amend
。
关于git - 在 rebase -i 期间重写提交消息时如何使 git show diff?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16721183/