List the lines that differ between files. The syntax is
diff File1 File2
where File1
is the reference file, and File2
is the (newer) file being compared to the reference.
Lines that are in File1
but not in File2
will appear with a leading <
(going out of the screen/document), while lines in File2
but not File1
will have a leading >
(coming into the screen/document).
Highlighting differences
To highlight the specific differences in the lines that have changed, there exist a script, distributed with Git, called diff-highlight. Once you have found it (try: locate diff-highlight
), the best way to use it is to copy the script somewhere in your path and make it executable (chmod u+x diff-highlight
). You can then use it as:
diff -u File1 File2 | diff-highlight
where the -u
option is required to change the first character from the uninformative <>
characters into _+
, which diff-highlight uses to recognize which lines have changed.