如何通过 `git diff` 获取 `git commit --verbose` 的输出?

4
我要达到的目标是调用git diff --verbose(错误:无效选项),以获得调用git commit --verbose时相同的输出:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   modified:   README.md
#
# Untracked files:
#   .gitignore
#
# ------------------------ >8 ------------------------
# Do not touch the line above.
# Everything below will be removed.
diff --git a/README.md b/README.md
index 267d5e2..b5f70de 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@

-# Sandbox
+# SANDBOX

+Some new text

我发现了git diff --patch-with-stat命令,虽然很接近我想要的结果,但输出的内容不是很友好,并且它不会显示未跟踪的文件,而我需要这个功能。
 README.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 267d5e2..b5f70de 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@

-# Sandbox
+# SANDBOX

+Some new text

git diff --verbose在哪里?有没有其他命令可以获得与 git commit --verbose 相同的输出?

1个回答

1

git diff --patch --stat 仍然是最佳选择,但可以从一个额外的命令中受益:

git ls-files -o

使用 -o 参数,git ls-files 命令将在输出中显示其他(即未跟踪的)文件。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接