
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Basic Work Cycle
|
35
The svn diff command produces this output by comparing your working files
against the cached pristine copies within the .svn area. Files scheduled for addition
are displayed as all added-text, and files scheduled for deletion are displayed as all
deleted text.
Output is displayed in unified diff format. That is, removed lines are prefaced with a
- and added lines are prefaced with a +. the svn diff command also prints filename
and offset information useful to the
patch program, so you can generate patches by
redirecting the diff output to a file:
$ svn diff > patchfile
For example, you could email the patchfile to another developer for review or test-
ing prior to commit.
svn revert
Now suppose you see the previous diff output, and realize that your changes to
README are a mistake; perhaps you accidentally typed that text into the wrong file
in your editor.
This is a perfect opportunity to use
svn revert.
$ svn revert README
Reverted 'README'
Subversion reverts the file to its pre-modified state by overwriting it with the cached
pristine copy from the .svn area. But also note that
svn revert can undo any sched-
uled operations—for example, you might decide that you don’t want to add a new
file after all:
$ svn status foo
? foo
$ svn add foo
A foo
$ svn revert foo
Reverted 'foo' ...