3
votes

I have a few files that were part of an update that were mistakenly committed to the main trunk before they were ready. Is there a way to 'undo' this checkout and roll the repository back a version, while still keeping the changed file in my checkout?

I'm using tortiseSVN ver 1.6.5 on Windows XP, if that makes any difference.

example: I updated a file, it is now at revision 659, previous version of this file was 600. I would like to keep version 659 on my checkout, but make what is currently version 600 the latest one again (ie version 660).

I tried making a copy of my current version, rolled back the regular version to 600, then tried to commit it back, but it tells me there are no changes to commit.

3

3 Answers

3
votes

I usually copy the file I want to keep to a temporary location, do the rollback, then copy the preserved file back in... Though, for all I know, I'm just taking the easy approach and there's something better out there.

2
votes

You want a reverse merge, not an update to an old revision.

Let's say the revision you just committed (and want to roll back) was 42.

# rollback
svn merge -c -42
svn commit
# now r43 is good but we want r42's version of foo.c in our working copy
svn merge -c -43 foo.c
-1
votes

Ideally you’d use “Update to revision” which will revert your working copy to a specified revision number after which you can commit back. For the sake of simplicity, I’d do this after taking a copy of your current working directory then just move the copy back after the update.