Git diff -w仅在开始和结束时忽略空白。行结束 [英] Git diff -w ignore whitespace only at start & end of lines

查看:1007
本文介绍了Git diff -w仅在开始和结束时忽略空白。行结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢使用 git diff -w 来忽略空格的差异。但是,我只注意到它甚至忽略了线条中间的空白区别。我怎么能只忽略在开始(^)或结束($)行的空白区别? 为了结束

  git diff --ignore-space-at-eol 



而不是你目前使用的是什么:

  git diff -w(--ignore-all-space)

如果你想要一个内置的解决方案,那么它是不幸的。



然而,如果你不介意让你的手变脏,那么会有一个相当老的补丁浮出来,支持--ignore-space-at-sol。


I love to use git diff -w to ignore whitespace differences. But, I just noticed that it ignores even whitespace differences in the middle of lines. How could I only ignore whitespace differences that come at the start (^) or end ($) of lines?

解决方案

For end of line use:

git diff --ignore-space-at-eol

Instead of what are you using currently:

git diff -w (--ignore-all-space)

For start of line... you are out of luck if you want a built in solution.

However, if you don't mind getting your hands dirty there's a rather old patch floating out there somewhere that adds support for "--ignore-space-at-sol".

这篇关于Git diff -w仅在开始和结束时忽略空白。行结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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