Unfortunately, I cannot explain exactly what happened. The result is the following: In my repository I have a file foo.bar for which the correct version is HEAD-1. How can I create a new revision, such that the only difference between HEAD and HEAD+1 is that foo.bar in HEAD+1 is the one from HEAD-1. All other elements of the repository should be identical in HEAD+1 to those of HEAD.

By invoking

svn update -rHEAD-1 foo.bar

I obtain a working copy which is the one I want to become HEAD+1. However, svn status doesn't show anything.

I hope my question make some sense...


From what I understand, although the rest of the changes in your HEAD revision are fine, you did a mistake in foo.bar and you want to retrieve that for your next revision. Here's how:

Take a snapshot of your foo.bar from the previous revision, using the command you have specified

svn update -r HEAD-1 foo.bar

Then, make a copy of this file and save it as foo.correct.bar

cp foo.bar foo.correct.bar

Restore the file to your current revision

svn update -r HEAD foo.bar

Then, copy over your saved (and correct version of) foo.bar to overwrite the current messed-up version

mv foo.correct.bar foo.bar

Commit it back in as revision HEAD+1

svn commit foo.bar -m "Restoring foo.bar from older revision HEAD-1"

Hope that helps, Sudipta

  • I guess this is a classical example of KISS (=Keep It Stupid Simple). I thought I should use some fancy-svn-trick... Thanks a lot!
    – Dror
    Aug 12 '11 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.