Other answers are complete enough, but in providing ways of showing somehow invisible differences explicitly. However, there's another option: ignoring these differences, which are somehow unimportant. In some cases, it's not useful to be informed about these differences.
diff
command has some useful options regarding this:
--strip-trailing-cr
strip trailing carriage return on input
-B, --ignore-blank-lines
ignore changes where lines are all blank
-Z, --ignore-trailing-space
ignore white space at line end
Personally, I found --strip-trailing-cr
useful, especially when using -r
(i.e. --recursive
) option on large projects, or when Git's core.autocrlf
is not false
(i.e. is either true
or input
).
For more information on these options and more, see its man page (or via man diff
).
Note: Using these options affects the performance of getting results, especially in the case of huge files/directories. In one of my own cases, it increased the manipulation time from 0.321s
to 0.422s
.
sed -n l filename
. If it won't help, add a data example anddiff
output here. – rush Aug 17 '12 at 13:18file
command will hint you about file content, including things likeASCII text, with CRLF line terminators
vsASCII text
. – Stéphane Gourichon Dec 15 '15 at 16:44ls -l
(orstat
) on both files and compare the sizes (and include that information in any question). That’s a minimal, obvious first step toward diagnosing the situation. – G-Man Says 'Reinstate Monica' Mar 03 '20 at 07:58