Fusion Developer

SVN – Revert to a different version

Reverting to a different version using subversion is a relatively easy procedure. I had a problem with our project with regards to a colleague commiting to the SVN and creating a lot of errors. This was fixed by reverting the SVN repository to a previous version, checking out his code into a separate directory and merging the files using winmerge.

This is the state of the project before the revert:

Before the merge with a previous version

The first step is to identify the current revision number and make sure that we have the latest version on the server. To do this, we need to execute the following command:

svn update

In this example, it is revision 9.

The next step, is to  actually merge to the previous version. In this example, we want to revert to revision 8. To do this, we execute the following command from within the root working directory:

svn merge -r 9:8 ./

We then need to commit these changes, and we are ready to carry on developing! To commit, execute the following command:

svn commit ./ -m 'reverted'

And that’s it! Here is the result after the revert:

After the merge to a previous version

For those that would like to see the whole process, here it is:

SVN revert to previous version procedure

Until next time,

Leave a Reply