Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I return to an older version of our code in Subversion?

Tags:

svn

backport

I'm working on a project with a friend and I want to return to an older version of our code and set it to be the current. How do I do it?

I'm using "anksvn" on vs08.

I have the version that I want on my PC, but the commit is failing; The message that I get is "commit is failed, file or directory is out of date."

I also have the subversion client on my PC.

like image 402
Chen Kinnrot Avatar asked May 02 '09 08:05

Chen Kinnrot


People also ask

What is revert in svn?

Reverts any local changes to a file or directory and resolves any conflicted states. svn revert will not only revert the contents of an item in your working copy, but also any property changes.

How do I diff two revisions in svn?

Display the differences between two paths. The ways you can use svn diff are: Use just svn diff'to display local modifications in a working copy. Display the changes made to TARGET s as they are seen in REV between two revisions.


1 Answers

Basically you need to "merge backwards" - apply a diff between the current and previous version to the current version (so you end up with a working copy looking like the old version) and then commit again. So for example to go from revision 150 (current) back to revision 140:

svn update svn merge -r 150:140 . svn commit -m "Rolled back to r140" 

The Subversion Red Book has a good section about this.

like image 150
Jon Skeet Avatar answered Sep 23 '22 01:09

Jon Skeet