2015-11-18 114 views
3

我後的目標是調用,例如,git diff --verbose(錯誤:無效選項)來獲取你打電話時git commit --verbose得到相同的輸出:如何通過`git diff`獲取`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

git diff --patch --stat仍然是最好的選擇,但可以從一個附加命令受益:

git ls-files -o 

隨着-o,該git ls-files將在輸出中顯示其他(即未跟蹤)文件。