04.08.2013 Views

Version Control with Subversion - Electrical and Computer ...

Version Control with Subversion - Electrical and Computer ...

Version Control with Subversion - Electrical and Computer ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

svn revert<br />

Now suppose you see the above diff output, <strong>and</strong> realize that your changes to README are a mistake;<br />

perhaps you accidentally typed that text into the wrong file in your editor.<br />

This is a perfect opportunity to use svn revert.<br />

$ svn revert README<br />

Reverted 'README'<br />

<strong>Subversion</strong> reverts the file to its pre-modified state by overwriting it <strong>with</strong> the cached “pristine” copy<br />

from the .svn area. But also note that svn revert can undo any scheduled operations—for example,<br />

you might decide that you don't want to add a new file after all:<br />

$ svn status foo<br />

? foo<br />

$ svn add foo<br />

A foo<br />

$ svn revert foo<br />

Reverted 'foo'<br />

$ svn status foo<br />

? foo<br />

Note<br />

svn revert ITEM has exactly the same effect as deleting ITEM from your working copy<br />

<strong>and</strong> then running svn update -r BASE ITEM. However, if you're reverting a file, svn revert<br />

has one very noticeable difference—it doesn't have to communicate <strong>with</strong> the repository<br />

to restore your file.<br />

Or perhaps you mistakenly removed a file from version control:<br />

$ svn status README<br />

README<br />

$ svn delete README<br />

D README<br />

$ svn revert README<br />

Reverted 'README'<br />

$ svn status README<br />

README<br />

Look Ma! No Network!<br />

Guided Tour<br />

All three of these comm<strong>and</strong>s (svn status, svn diff, <strong>and</strong> svn revert) can be used <strong>with</strong>out any network access.<br />

This makes it easy to manage your changes-in-progress when you are somewhere <strong>with</strong>out a network connection,<br />

such as travelling on an airplane, riding a commuter train or hacking on the beach.<br />

32

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!