Diff Command 2
[Previous] [Main] [Next]

More Diff Commands


The most commonly used version is with the -Q and the -c options. The -c option tells CVS to give us a few lines around the change so we can see it in Context.

floss$ cvs -Q diff -c
Index: hello.c
===============================================
RCS file: /usr/local/cvs/myproj/hello.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 hello.c
*** hello.c     1999/04/18 18:18:22     1.1.1.1
--- hello.c     1999/04/19 02:17:07
***************
*** 4,7 ****
---4,8 --
  main ()
  {
    printf ("Hello, world!\n");
+   printf ("Goodbye, world!\n");
  }

The "***" indicate lines from the first revision. If any lines were deleted they would be in between the **** lines. The "---" marks indicate lines in the second revision. The plus (+) sign indicate that this line was added. The other lines ( main () {...} are the context.

There might be several sets of the *** and --- lines. These are called "hunks."

A minus sign (-) would indicate a line that was deleted.
An exclamation point (!) indicates a line that was changed.