2016-09-13 30 views
2

我想看看自從初次提交以來我做了哪些編輯。如何使用git查看自初次創建以來所有文件的更改?

當我從供應商導入和控制代碼時,會發生這種情況。

所以工作流程是這樣的:

  1. git add/commit
  2. 進行編輯
  3. git commit
  4. 去2

我希望看到所有的記錄我的自從他們是第一個創建者以來對文件的更改編輯。

git log -p -- <file>不起作用,因爲該文件的初始創建顯示爲所有行的一個巨大附加。像這樣:

commit 82abdc4cc52d70dcabdec4b987632f226a1e8bc4 
Author: Greg Bell <[email protected]> 
Date: Fri Aug 26 07:13:22 2016 +1000 

    initial import from vendor 

diff --git a/vendor/source.h b/vendor/source.h 
new file mode 100644 
index 0000000..baf6d8a 
--- /dev/null 
+++ b/vendor/source.h 
@@ -0,0 +1,221 @@ 
+/* 
+ * Error codes returned by blah. 
+ * 
+ * Copyright (C) 1998-2000 blah blah 
+ * 
+ * This program is free software; you can redistribute it and/or modify 
+ * it under the terms of the GNU General Public License as published by 
+ * the Free Software Foundation; either version 3 of the License, or 
+ * (at your option) any later version. 
+ * 
+ * This program is distributed in the hope that it will be useful, 
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+ * GNU General Public License for more details. 
+ * 
+ * You should have received a copy of the GNU General Public License along 
+ * with this program; if not, visit the http://fsf.org website. 
+ */ 

+#define RERR_OK   0 
+#define RERR_SYNTAX  1  /* syntax or usage error */ 
. 
. (all 1250 lines shown) 
. 

當我在整個目錄上運行日誌而不是僅僅一個文件時,這會嚴重地混亂輸出。

沒有分支 - 也許是一個關鍵的初步失誤,雖然這將是討厭有切換基於我是否引進新的文件或編輯現有的分支(然後合併等)

我認爲這很難,因爲文件可能隨時進入,因此可能會在整個Git歷史記錄中添加所有文件,所以我不認爲我可以使用..或各種revision syntaxes

看起來像一個簡單的用例,但我閱讀git-log和Google搜索的文檔沒有任何結果。

回答

2

如果我理解正確,您只想查看已做出的修改,並忽略添加新文件。如果這確實是問題,你可以使用--diff-filter開關來限制你希望看到什麼樣的變化,併發送M(簡稱修改)的說法:

$ git log --diff-filter=M -p -- <file> 
+1

這就是它!非常感謝! –

相關問題