git diff - 显示行结束更改? [英] git diff - show me line ending changes?

查看:109
本文介绍了git diff - 显示行结束更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的编辑正在改变我的源文件的行尾。当我执行 git diff 时,我看到同一行两次 - 一次是 - ,一次是<$ c $



如何得到 git diff - 没有明显的区别。 >向我展示这种变化实际上是什么?

首先,确保使用彩色输出(例如 git diff --color ),并且你已经用(例如)启用了空格高亮。

  git config color.diff.whitespacered reverse

这可能不适用于所有但是,作为 git 的情况似乎并未突出显示已删除的行的尾部空白。要查看已删除的空白,只需使用

  git diff -R 



可以将比较中的增加一侧的空格放在比较中的那一侧,它会突出显示。



更多详情,请参阅这个SO问题的答案。 。


My editor is changing the line endings of my source files. When I do git diff, I see the same line twice -- once with - and once with + -- with no visible difference.

How do I get git diff to show me what this change actually was?

解决方案

First, make sure you're using the coloured output (e.g. with git diff --color) and that you've enabled whitespace highlighting with (e.g.)

git config color.diff.whitespace "red reverse"

This might not work in all cases, however, as git doesn't appear to highlight trailing whitespace for removed lines. To see whitespace that you've deleted, simply use

git diff -R

to put the whitespace on the 'added' side of the comparison, where it does get highlighted.

For more detail, see the answers at this SO question.

这篇关于git diff - 显示行结束更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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