git rebase -i 提交标志?

git rebase -i commit flags?

应用压缩或重写的提交时,rebase -i 会自动调用提交编辑器。我习惯于用 commit -v 提交(我想看看我提交的差异),但是 rebase-invoked git commit 似乎没有设置 -v。这在压缩提交时非常烦人。

有没有办法配置 git commit 标志以便在 rebase loop 中使用?

来自git-commit(1)

-v, --verbose

Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message template to help the user describe the commit by reminding what changes the commit has. Note that this diff output doesn’t have its lines prefixed with #. This diff will not be a part of the commit message. See the commit.verbose configuration variable in git-config[1].

这意味着可以通过

全局永久启用详细模式
git config --global commit.verbose true

这样,-v选项将从现在开始默认启用。

或者,可以通过传递 -c 全局选项在每个命令的基础上启用该选项:

git -c commit.verbose=true rebase -i