Skip to content

diff usage reminder

Louis Maddox edited this page Dec 14, 2017 · 8 revisions

Hint: to make life easy, just use diff -u to produce unified format with left margin +/- symbols

  • may not be a good move for large files/many changes, in which case the terser standard format is explained below for reference

  • by convention (Wiki), the first file argument should be the original, and the second should be the new version

  • first file argument is the one listed above the --- fold, the second below it

  • in this context, an addition/insertion is represented with a < and a removal/deletion with >

    • < above the fold = "has come in" (has replaced what's below the fold)
    • > below the fold = "has gone out" (has been replaced by what's below the fold)
  • A diff call will not necessarily give the same numbers of lines above and below the fold with the file arguments passed in a different order!

Interpreting diff output codes

  • The output of diff is plaintext, for specified inclusive intervals
Clone this wiki locally