Show diff when writing commit messages during an interactive rebase

本秂侑毒 提交于 2019-12-04 01:54:58

To show the diff:

git -c commit.verbose=true rebase --continue

To make all commits verbose without having to specify -c commit.verbose=true every time, add this to ~/.gitconfig:

[commit]
    verbose = true

Reference: man git-config.

You can do:

git -c commit.verbose=true rebase --continue

If you get tired copying that command you can create an alias in your ~/.gitconfig:

[alias]
    myrebasecontinue = "!git -c commit.verbose=true rebase --continue"

And now just do:

git myrebasecontinue

In the middle of a rebase,

git diff

shows you the changes not yet added to the commit,

git diff --cached 

shows you the new changes you committed, and

git show

shows you the original changes in the commit you're editting.

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