在交互式基础上编写提交消息时显示差异 [英] Show diff when writing commit messages during an interactive rebase

查看:74
本文介绍了在交互式基础上编写提交消息时显示差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行常规git commit时,git commit --verbose在编写提交消息时在文本编辑器中显示差异.

When doing a regular git commit, git commit --verbose shows the diff in the text editor when writing the commit message.

假设我正在进行交互式变基(git rebase --interactive)以编辑以前的提交.要继续"重新设置基准,我运行git rebase --continue.这将打开一个用于编辑提交消息的文本编辑器,但不显示差异.对提交进行更改后,在交互式变基过程中(重新)写入提交消息时,如何显示差异?

Suppose I am doing an interactive rebase (git rebase --interactive) to edit previous commits. To 'continue' rebasing, I run git rebase --continue. This opens a text editor for editing the commit message, but it does not show the diff. After making changes to a commit, how can I display the diff when (re)writing the commit message during an interactive rebase?

git rebase --continue --verbose似乎不是有效的命令...

git rebase --continue --verbose doesn't seem like a valid command...

推荐答案

显示差异:

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

要使所有提交都变得冗长而不必每次指定-c commit.verbose=true,请将其添加到~/.gitconfig:

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

[commit]
    verbose = true

参考: man git-config

这篇关于在交互式基础上编写提交消息时显示差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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