2016-01-26 97 views
1

我想提供和只提交相關的更改。git只添加非空白變化

在我的.gitconfig我丟棄了core.autocrlf = input一行以跳過行結束轉換。

現在我不知道爲什麼,但我行尾仍在轉換

已經籤類似的解決方案給予但沒有任何工程。 我只想提交非空白變化。

我試圖

git add myfile 

git diff HEAD 
--- /dev/null 
+++ b/profiles/minimal/minimal.info 
@@ -0,0 +1,6 @@ 
...content of file here (practically all is changed) 

現在刪除空白

git diff HEAD -w | git apply --cached --ignore-whitespace 

,我得到一個錯誤

error: myfile: already exists in index 

回答

0

你只是想添加文件,該文件是已被添加到索引。
您不能多次添加它。看起來你已經執行該命令或手動添加使用git add


是什麼命令不(以便其他人可以學習)文件:哪個做以下

git diff HEAD -w | git apply --cached --ignore-whitespace 

# Generate the diff between HEAD to index 
git diff HEAD -w 

# apply the patch to the index 

git-apply

將補丁應用於文件和/或索引