Subversion - Diff Format

The unified diff format describe changes as "hunks" (or snippets) of file's content where each line of text is prefixed with a single-character code:

  • a space: the line was unchanged
  • a minus: the line was removed
  • a plus: the line was added

In the context of "svn diff", those minus signs and plus signs show how the lines look before and after your modification.

Subversion uses its internal diff engine, which produces unified diff format, by default. If you want diff output in a different format, specify an external diff program using —diff-cmd option and pass any additional flags that it needs via the —extensions (-x) option. For example, you might want Subversion to defer its difference calculation and display to the GNU diff program, asking that program to print local modification made to file foo.c in context diff format (another flavor of difference format) while ignoring changes made only to the case of the letters used in the file's contents:

svn diff --diff-cmd /usr/bin/diff -x "-i" foo.c
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License