僅添加非空白更改 - Add only non-whitespace changes

語言: CN / TW / HK

問題:

I have my text editor to automatically trim trailing whitespace upon saving a file, and I am contributing to an open source project that has severe problems with trailing whitespace.我的文本編輯器可以在保存文件時自動修剪尾隨空格,並且我正在為一個尾隨空格存在嚴重問題的開源項目做出貢獻。

Every time I try to submit a patch I must first ignore all whitespace-only changes by hand, to choose only the relevant information.每次我嘗試提交補丁時,我必須首先手動忽略所有僅空白的更改,僅選擇相關信息。 Not only that, but when I run git rebase I usually run into several problems because of them.不僅如此,當我運行git rebase我通常會因為它們而遇到幾個問題。

As such I would like to be able to add to index only non-whitespace changes, in a way similar that git add -p does, but without having to pick all the changes myself.因此,我希望能夠以類似於git add -p的方式將非空白更改添加到索引中,但不必自己選擇所有更改。

Does anyone know how to do this?有誰知道如何做到這一點?

EDIT: I cannot change the way the project works, and they have decided, after discussing it on the mailing list, to ignore this.編輯:我無法改變項目的工作方式,他們在郵件列表上討論後決定忽略這一點。


解決方案:

參考一: http://stackoom.com/question/EkZB
參考二: Add only non-whitespace changes
「其他文章」