9

How can we get an output similar to what we expect from diff --side-by-side --suppress-common-lines --context=3?


One can use diff --side-by-side --suppress-common-lines file1 file2 to have side-by-side reduced view for a patch.

Or use diff --context=3 file1 file2 or diff --unified=3 file1 file2 to have a the context displayed around the changes.

But upon combining --side-by-side and --context or --unified we get the error:

diff: conflicting output style options

4
  • 4
    Give vimdiff a try. You'll like it. Commented Jun 22, 2018 at 1:44
  • 1
    TBH, by that time, I was really avoiding vim. A year and half now, and I'm almost always using it ':D
    – weshouman
    Commented Feb 27, 2020 at 13:14
  • Also try gvimdiff. The GUI version of vimdiff. Commented Dec 29, 2021 at 23:48
  • 1
    @JohnKugelman The problem with vimdiff is that it crashes for very large files. We need it to discard most of the common lines at the diffing algorithm (keeping some for context) and then have vim only show what remains. At the moment this isnt how it works (vim keeps it all in the buffer in case you want to expand the common lines)
    – Hashbrown
    Commented Jun 22, 2023 at 10:56

0

Browse other questions tagged or ask your own question.