Comparing versions of a given file in subversion

First determine the changes for the file

svn log <filename>

Output may be as:

------------------------------------------------------------------------
r86 | root | 2010-12-19 07:33:38 -0600 (Sun, 19 Dec 2010) | 1 line

committing all changes at lower levels
------------------------------------------------------------------------
r63 | root | 2010-11-28 11:55:11 -0600 (Sun, 28 Nov 2010) | 1 line

Updated to version Anteater 2010-11-07
------------------------------------------------------------------------
r9 | root | 2009-08-05 17:06:54 -0500 (Wed, 05 Aug 2009) | 1 line

wiki installed and data overlayed
------------------------------------------------------------------------

Then do the compare

Compare working copy (not necessarily latest version) to a given version. In this case comparing version 63 to working copy

svn diff --revision 63 <filename>

Comparing two specific revisions

svn diff --revision 9:63 <filename>

Reverting back to an earlier version

Although the merge command is the usual option to revert back, I like the export command as it is more obvious what happens here.

svn export -r 6 <filename>

Will then put the specified version of the file overwriting the current version. This might overwrite any local changes - so beware.


Reference: Examining History


QR Code
QR Code tech:svn:comparing_versions (generated for current page)