仅添加非空白更改 - 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
「其他文章」