2014-09-03 201 views
1

git status給我看,很少有文件被修改。但是當我用下面的任何參數執行git diff時,它是空的。使`git status`忽略空白變化

--ignore-space-at-eol 
     Ignore changes in whitespace at EOL. 

    -b, --ignore-space-change 
     Ignore changes in amount of whitespace. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be equivalent. 

    -w, --ignore-all-space 
     Ignore whitespace when comparing lines. This ignores differences even if one line has whitespace where the other line has none. 

我試過git checkout .重置此更改,但它沒有幫助。我該如何將這些文件回滾到原始狀態(以便它們不再被「修改」),或者使git status永久忽略空白更改?

git reset --hard也不起作用。

回答

2

如果你要放棄當前的git回購

使用所有的變化,git checkout -- .

做檢查這需要若有使用git clean -n爲未跟蹤文件清除的文件。

注:

非常小心git reset --hard,這將刪除所有未提交的文件。更改將永久丟失(無法恢復)。