2012-03-28 64 views
0

當我運行「git rm」時,我可以看到文件在「git status」中被刪除。但是,當我運行「git log --stat」時,我看到的是一堆行被從文件中刪除。要推斷一束是否等於一切並不容易。我嘗試傳遞選項來顯示重命名,但它似乎也不推斷刪除(可能會認爲它是重命名爲NULL)。它看起來像「 - 名稱狀態」將顯示刪除的文件與「D」,但「 - 狀態」將被忽略,如果兩個選項都通過。如何獲得「git log」以顯示已刪除的文件?如何使用Git查看已刪除的文件?

回答

2
git log --stat --summary 

會給你diffstat(線改變),還提到在年底的創作/缺失。


實施例:

commit e0d418054af3755a933805e587a02d2991e98625 
Author: [author redacted] 
Date: Fri Jan 13 17:40:25 2012 -0800 

    Remove jslint 

jslint   | 17 - 
jslint-all  | 2 - 
jslint.smjs.js | 4270 -------------------------------------------------------- 
3 files changed, 0 insertions(+), 4289 deletions(-) 
delete mode 100755 jslint 
delete mode 100755 jslint-all 
delete mode 100644 jslint.smjs.js 
1

如何使用git log--diff-filter=D

--diff-filter=[ACDMRTUXB*] 
    Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their 
    type (i.e. regular file, symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown (X), or 
    have had their pairing Broken (B). Any combination of the filter characters may be used. When * 
    (All-or-none) is added to the combination, all paths are selected if there is any file that matches 
    other criteria in the comparison; if there is no file that matches other criteria, nothing is selected. 
相關問題