2

I really like the character-level highlighting of diff-so-fancy.

How can I use it to compare files without using git?

Tom Hale
  • 2,410

2 Answers2

4

If what you want is to compare files that are not under git, you can simply use git diff --color file1 file2 | diff-so-fancy.

If both files are in the same git repository, you'll need to use git diff --no-index --color file1 file2 | diff-so-fancy.

user2313067
  • 2,515
  • 1
  • 14
  • 14
1

From this issue it seems diff-so-fancy currently requires git-formatted input to achieve correctly coloured output.

As a work-around:

dsf() { git diff --no-index --color "$@" | diff-so-fancy }

Thanks to this answer for pointing me in the right direction.

Tom Hale
  • 2,410