仅添加非空白更改 - Add only non-whitespace changes
问题:
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
- 用 JavaScript 计算昨天的日期 - Calculate the date yesterday in JavaScript
- 允许保留 2 位小数 - Allow 2 decimal places in
- 在 Android 上防止屏幕旋转 - Prevent screen rotation on Android
- 如何更新 RecyclerView 适配器数据 - How to update RecyclerView Adapter Data
- 日历重复/重复事件 - 最佳存储方法 - Calendar Recurring/Repeating Events - Best Storage Method
- (13:权限被拒绝)连接到上游时:[nginx] - (13: Permission denied) while connecting to upstream:[nginx]
- 如何使用 git 检查 GitHub 拉取请求? - How can I check out a GitHub pull request with git?
- 正则表达式:删除包含“帮助”等的行 - Regex: Remove lines containing “help”, etc
- >>>和>>之间的区别 - Difference between >>> and >>
- JavaScript 中反引号 (`) 的用法 - Usage of the backtick character (`) in JavaScript
- C 模板typedef - C template typedef
- 仅添加非空白更改 - Add only non-whitespace changes
- Python中exit()和sys.exit()之间的区别 - Difference between exit() and sys.exit() in Python
- Git:仅列出“未跟踪”的文件(还有自定义命令) - Git: list only “untracked” files (also, custom commands)
- 谷歌使用什么数据库? - What database does Google use?
- 在CLR中投放与使用'as'关键字 - Casting vs using the 'as' keyword in the CLR
- 值对的 Java 集合? (元组?) - A Java collection of value pairs? (tuples?)
- 'git 责备' 有什么作用? - What does 'git blame' do?
- 蚂蚁警告:“'includeantruntime'未设置” - ant warning: “'includeantruntime' was not set”
- 如何在不等待的情况下安全地调用 C# 中的异步方法 - How to safely call an async method in C# without await