如果仅更改空格和换行符,如何从"git status"中忽略文件 [英] How to ignore files from 'git status' if only white spaces and line breaks changed

查看:239
本文介绍了如果仅更改空格和换行符,如何从"git status"中忽略文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常使用一些制表符而不是空格来推送代码,反之亦然,或者插入换行符以提高代码的可读性.我如何告诉git不要寻找那些更改?

I often push code with some tab instead of spaces or vice versa, or insert a line break to improve code readability. How do I tell git not to look for those changes?

推荐答案

这应该可以解决问题:

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

修补程序将与添加一起应用,而无需更改空格.

Patch would be applied with add without white space changes.

这篇关于如果仅更改空格和换行符,如何从"git status"中忽略文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆