Tuesday, March 18, 2008

The diff Command

The diff command shows the difference between two revisions of a file. If you invoke this command without any options, CVS shows the difference between the current local working file and the earlier revision stored in the repository. The current local working file need not be saved in the repository using the commit command. For example, to show a difference between the new.txt file, which is saved in the repository yesterday, and the local working copy of the same file, the syntax is:
$ cvs diff –D yesterday new.txt new.txt

various options that you can use with the diff command to display differences according to your requirement:
Options of the diff Command
Option Description
-lines Displays lines of context.
-a Treats files as text to compare files line-by-line.
-b Ignores white spaces.
-B Ignores changes, such as insertion and deletion of blank lines.
-binary Reads and writes data in binary format.
-brief Displays information whether the files differ.
-c Uses the content output format.
-d Changes the algorithm to find minor differences.
-expand-tabs Expands tabs to tableserve the alignment of tabs in the input files.
-H Handles large files with numerous scattered changes.
-I Ignores changes in the case.
-I Ignore changes, such as insertion or deletion of lines.
-L Uses label instead of the context format and unified format headers.
-s Displays a report when the two files are same.
-u Uses the unified output format.
-w Ignores white spaces when comparing files.
-y Uses the side-by-side output format.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home