如何使用git diff显示一些看不见的字符差异? [英] how to use git diff show some invisible characters differences?
本文介绍了如何使用git diff显示一些看不见的字符差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用git diff
时,我看到了如下差异:
When I use git diff
, I saw the differences like below:
- self.conv_2 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False)
+ self.conv_2 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False)
我确定这两行之间没有白色退格键差异. 但是,我认为这两行是完全相同的.
And I'm sure there are no white backspace difference in these two lines. However, I think these two lines are totally same.
我想知道为什么git认为它们不同吗?
I wonder why does git think they are different?
有没有办法让git diff
显示特殊字符差异?
And is there a way to let git diff
show the special characters difference?
推荐答案
The --ws-error-highlight
flag might be useful.
git diff --ws-error-highlight=all
或者,您可以将git diff
输出传送到cat
并使用其-A
标志显式打印各种非打印字符.
Alternatively, you can pipe the git diff
output to cat
and use its -A
flag to explicitly print a variety of non-printing characters.
git diff | cat -A
这篇关于如何使用git diff显示一些看不见的字符差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文