SVN version rollback
When we want to discard modifications to a file, we can use SVN revert command.
The svn revert operation will undo any local changes in a file or directory.
We modify the file readme and view the file status.
root@runoob:~/svn/runoob01/trunk# svn status
M readme
At this point we find the modification is wrong and want to undo it. Using svn revert on the file readme restores it to the unmodified state.
root@runoob:~/svn/runoob01/trunk# svn revert readme
Reverted 'readme'
View the status again.
root@runoob:~/svn/runoob01/trunk# svn status
root@runoob:~/svn/runoob01/trunk#
After the revert operation, the readme file is restored to its original state. The revert operation can not only restore a single file to its original state, but also restore an entire directory. Use the -R command to restore a directory, as follows.
svn revert -R trunk
But what if we want to restore an already committed version?
To eliminate an old version, we must undo all changes in the old version and then commit a new version. This operation is called reverse merge.
First, find the current version of the repository. It is now version 22. We want to roll back to a previous version, such as version 21.
svn merge -r 22:21 readme