one
one

Reputation: 2585

how to use git diff show some invisible characters differences?

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.

I wonder why does git think they are different?

And is there a way to let git diff show the special characters difference?

Upvotes: 14

Views: 5945

Answers (1)

chuckx
chuckx

Reputation: 6877

The --ws-error-highlight flag might be useful.

git diff --ws-error-highlight=all

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

Upvotes: 31

Related Questions