In Unix, execute
diff -y file1 file2
can see two files side-by side. And execute
diff -c file1 file2
can see two files' difference with 3 line context. Execute
diff -y --supress-common-lines
can suppress all the common lines. But what if I want to display side-by-side but with 3 lines context? --supress-common-lines
will provide no context at all
diff -y -c file1 file2
will give me conflicting output style options
. Is there a way to achieve that?
It seems that
diff(1)
doesn't allow it, but vimdiff seems to work:Downside is that it's interactive-only, you can't dump the diff to a file, but then again, side-by-side diffs are not very useful in files. However, if you do want to save it to a file, this awesome answer will have you do:
Not ideal, but it's something.