User Tools

Site Tools


diff_notes

diff word by word

git diff --word-diff --no-index -- foo bar

or

git diff -U0 --word-diff --no-index -- foo bar

You can run this command even if the files are not part of a git repository.

Ref:- https://unix.stackexchange.com/a/330807/198064

Related commands:

  • git diff --no-index --color-words -- foo bar - to diff word by word
  • git diff --no-index --color-words=. -- foo bar - to diff character by character

head and diff

To diff headers of two files without creating any temporary files

% diff <(head -n 1 foo.20170102) <(head -n 1 foo.20170104)

ignore newline endings

diff --strip-trailing-cr file1 file2
diff_notes.txt · Last modified: 2023/03/01 21:02 by raju