在rebase -i期间重新提交提交消息时,如何让git show diff? [英] How do I make git show diff when rewording a commit message during rebase -i?

查看:170
本文介绍了在rebase -i期间重新提交提交消息时,如何让git show diff?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是使用 git commit --verbose 。是否有一个等价的选项/设置,当我在 git rebase --interactive

$ b $中改写提交消息时,会让git显示差异根据你在评论中的回答,执行 git diff HEAD ^ 不会对你有所帮助,除了 你只想重新提交上次提交。



但是在这种情况下,rebase是错误的工具。相反,您可以简单地在不改变索引的情况下执行 git commit --amend --verbose ,然后编辑提交消息,获取您要求的差异视图。



如果要使用差异视图重新输入较旧或多个提交消息,只需使用编辑节而不是 reword 节,然后使用 git commit --amend --verbose 在每个提交的索引中没有代码更改。

reword 应该只是使用编辑然后执行 git commit --amend -mnew message,而不进行任何只会改变提交信息的更改。



您还可以定义 git commit --amend --verbose git commit --verbose 作为别名所以你节省了一些打字,可以e。 G。简单地做 git cav git c --amend


I always use git commit --verbose. Is there an equivalent option/setting that will make git show me the diff when I'm rewording a commit message during git rebase --interactive?

解决方案

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.

这篇关于在rebase -i期间重新提交提交消息时,如何让git show diff?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆