How do I make git show diff when rewording a commit message during rebase -i?

谁都会走 提交于 2019-12-03 04:25:18

According to your answers in the comments, executing git diff HEAD^ will not help you, except you only want to rewored the last commit.

But in this case a rebase is the wrong tool anyway. Instead you can simply do git commit --amend --verbose without changes in the index and then edit the commit message, having the diff view you are asking for.

If you want to reword an older or multiple commit messages with having the diff view, just use the edit stanza instead of the reword stanza and then use git commit --amend --verbose without code changes in the index on each of the commits.

reword should only be a shortcut for using edit and then do git commit --amend -m "new message" without any changes which will only change the commit message.

You can also define git commit --amend --verbose or git commit --verbose as alias so you save some typing and can e. g. simply do git cav or git c --amend.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!