jack
jack

Reputation: 1317

SVN go back revision

I have a SVN repository running on a server - to which I commit my changes. After changes are commited, I do "svn update" on the server, in order to get my changes live. However, sometimes I make a commit(+update) that shouldn't be done - which means that I have live files running with errors in them.

So I want to make a "revert/undo" on my server, to go back to previous revision. I tried:

svn update -r <current revision -1>

But that didn't seem to do anything at all.

Here's a link I got on IRC: http://svnbook.red-bean.com/nightly/en/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo

I am not sure that's what I'm looking for, since I haven't made a merge nor a copy?

Upvotes: 2

Views: 4243

Answers (2)

Andriy
Andriy

Reputation: 2796

You should use:

cd <your project root>
svn merge <revision>:<revision - 1> .

Then review your changes and commit.

You can also use --dry-run option to see what merge command does without actually changing a working copy.

Upvotes: 2

DaveShaw
DaveShaw

Reputation: 52798

What the book is telling you to do is perform a "reverse merge" of the changes you made in your erroneous revision. A reverse merge will undo just the changes from that revision. They will now be local changes in your working copy. Diff them to ensure what you want is removed and them commit the old version. Using TSVN makes this much easier if you have it. You can just do a revert from the context menu on the Show Log screen.

If you have a clean working copy, just try it, as a merge is only local changes until committed.

Upvotes: 0

Related Questions