22 Jun 2008

You would think that reverting to a previous version of your application would be one of the key use cases for a version control system like Subversion and that it would be trivial to do, but it's actually not intuitive at all.

When I was first starting out with Subversion, I thought there would be a revert command that took a revision as an argument and basically rolled back your application to revision X. Alas, there is a revert command in SVN, but instead of reverting to a previous revision, it works to undo any local changes you've made to your working copy.

Here, then, is a very simple, plain English explanation of how to revert to a previous version of your application in Subversion, to help anyone who may be starting out with it and is lost.

To revert to a previous version of your application (roll back changes) in Subversion, you merge the changes from your current revision back to the revision you want to revert to. So, for example, if you want to revert the trunk of your application from revision 73 to 68, you would do the following:

  1. svn merge --dry-run -r:73:68 http://my.repository.com/my/project/trunk
  2. svn merge -r:73:68 http://my.repository.com/my/project/trunk
  3. svn commit -m "Reverted to revision 68."

Step 1 will perform a dry run and show you what the merge will produce. If you want to see exactly what changes will be applied, do a diff:

svn diff -r:73:68 http://my.repository.com/my/project/trunk

Step 2 actually performs the merge (you'd do this after you're happy with the dry run). At this point, realize what is happening: Subversion is calculating the changes between revision 73 and revision 68 of the trunk and applying them to your working copy. For the majority of the time, you will thus want your working copy to be a fully updated copy of the revision you are reverting from (in this example, revision 73).

Finally, since the merge happens on your local working copy, you need to commit it to the repository in Step 3.

Add Your Comment

Spam Protection by WP-SpamFree

How to revert (roll back) to a previous revision with Subversion

  1. Aral, I am an SVN idiot so thanks for this. I have been using Version for the mac – http://www.versionsapp.com/ It is a free download while in beta, and super simple to use. Hoping they release it at a decent price.

    chris breshears
  2. This is great! I was until recently using ZigVersion for Subversion. Going to the command line has made me more efficient with svn, but damn if a GUI doesn’t make sense for some of it’s more confusing commands.

    Ben
  3. That’s why good GUI tools are important – this is a no-brainer in TortoiseSVN (view change log, right-click the revision I want to roll back to and select “Revert to this revision”). It does everything necessary under the hoods.

    Borek
  4. These is no good GUI apps for subversion on Mac (I’m not a Mac user so I don’t really care). Even the brand new Versions seems to suck. The only sensible thing to do is to use a combination of Eclipse/Subclipse. At least that gives you consistent quality over all platforms it supports.

    pan69
  5. Good to know, I’ve run into this one too. But can these commands also be executed in Eclipse, without using the terminal?

    Michiel van der Ros
  6. Hey Aral,

    If you haven’t already, you might want to check out Git. It’s a fantastic version control system (created by Linus Torvalds) that truly takes the pain out of merging (and many other things too)!

    I host my personal projects at GitHub which is also a great git resource for public and private repositories (I’m completely unaffiliated).

    Luke Bayes
  7. I find it easier to use the cat command to get the version I want minus all the merging. Yes, this is an annoyance with SVN.

    Something like:
    $ svn stat -u build.xml
    Status against revision: 17451
    $ svn cat -r 17450 build.xml > build.xml

    Then you can commit.

    Mike
  8. I started using Git recently and that is working really well for me too.

    David
  9. +1 From me for Git, I’ve not started using it but have researched it quite extensively and am very impressed with what I’ve seen and heard.

    DannyT
  10. Hey guys,

    Thanks for the nods for Git. I did research it before starting on the Singularity site but I figured that I had enough unknowns in the project — what with me re-learning Python after several years and learning Google App Engine — that I’d limit the risk but being conservative in at least one part of it :)

    I may transition to it once we have the first release of the site though — it does sound much better (and I like the fact that you can commit locally).

    Aral
  11. Hey Mike, I’ll check out cat, thanks — it looks easier than merge if you only need to restore a single file. :)

    Aral
  12. I was happy to find this today – thx! However, I think the syntax you want is -r73:68, not -r:73:68.

    Max
  13. Thanks for the post, it really helped me out. I’m using Versions.app for the Mac like someone above, but there is no merge option so these commands came in really handy.. Thanks again! Oh, and the syntax was -r 73:68 for my version of SVN.

    Sandro
  14. Thanks for the post.
    I can add that the SVN “bible”, “SVN redbook”, clearly states this usage of svn merge with fine details as well:
    http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo

    Boaz.

    Boaz
  15. syntax error. change
    -r:73:68
    to
    -r 73:68

    ash
  16. thank you so much! You have saved me hours of reading.

    Victor
  17. Awesome…just what i needed… Thanks

    Vinayak
  18. Merci beaucoup :)
    (Thanks!)

    Amrac
  19. Gracias!!!!
    Thank you!!!

    El Demonio
  20. [...] whilst looking for a way to do this I came across a solution, which involes a revision merge and commit; basically taking your changes back to a previous [...]

    Miromedia Search Engine Optimisation Blog - Rollback a Subversion commit
  21. # revert back to revision in one line:
    svn update -r 2689

    petke
  22. Gr8 work, like it this way

    Mohit
  23. Thanks for the post, but the comment by petke worked much better for me – I didn’t have to resolve any conflicts during the rollback.

    Rob Searles
  24. Hi,

    Thank you very much for the information.

    Regards,
    Alan Haggai Alavi.

    Alan Haggai Alavi
  25. Thanks — this saved me quite a bit of work. I had to revert a change between two specific revisions that were NOT trunk. This worked like a charm.

    Nayan Hajratwala
  26. [...] Aral Balkan – How to revert (roll back) to a previous revision with Subversion (tags: svn revert rollback) [...]

    Steve Mactaggart’s Blog » Blog Archive » links for 2009-05-08
  27. Thank you very much :-)

    Sven Bachmann
  28. As far as I remember, you could just copy from an old revision to the HEAD revision, using the Repo browser. Unfortunately this is not possible anymore using the newest versions :-(
    It was a very simple but still meaningful way.

    Paul Pladijs
  29. Thanks for putting this up. Comment #20 above by petke works very well, too. I suppose that’s the way the developers intended for roll-backs, although I agree that “revert” seems more befitting than “update”…

    yungchin
  30. [...] I use this method on most my projects (private and freelance), e.g. I’m using it to synchronize my theme right here on satf. This is awesome because I tend to break stuff and it’s comforting to know that salvation is only one revert away. [...]

    Synchronizing Wordpress or website with SVN | satf
  31. Actually, petke’s way (using “svn up”) is *not* the same as using “svn merge”, and I don’t think it’s the way the developers intended for roll-backs. If you make changes after an “svn up” to a previous revision and try to commit them, Subversion won’t let you because your files are “out of date”.

    Nate
  32. Thank you for sharing this tip :)

    Tiago Almeida
  33. Thanks !

    If your working copy is on a network (it’s possible), you have to do like this :

    2. svn merge -r73:68 http://my.repository.com/my/project/trunk \\my.network.name\my\project\

    3. svn commit -m “Reverted to revision 68.” \\my.network.name\my\project\

    Alphonse
  34. Wait… can’t you just do “svn update -r “. That’s always worked for me…

    Chris
  35. Hello

    The command: svn merge -r:73:68… throws a “syntax error in revision argument ‘:73:68′ ”

    The first colon is a problem. svn merge -r 73:68… works fine.

    Aditya
  36. The command is svn merge -r 73:68 and not svn merge -r:73:68 as you have mentioned. There is no colon after -r and there should be a space instead.

    Vijay Dev
  37. svn merge –dry-run -r:73:68 http://my.repository.com/my/project/trunk

    should be

    svn merge –dry-run -r 73:68 http://my.repository.com/my/project/trunk

    John Malcolm
  38. Thanks for your very clear step-by-step explanation!

    Christian
  39. Thanks mate.

    Blah
  40. Thanks! This is just what I need. Anyway I use -rXX:YY not -r:XX:YY

    William Notowidagdo
  41. Thank you!! That was real useful! :)

    Sid
  42. I just found your post after searching for an easy way to revert to previous rev on SVN. Found the post useful, and it helped me greatly. Thank you.

    Just one thing I noticed in our version of subversion (1.1.4-2 .. very old) is that the command works best like this:

    svn merge -r 73:68 http://my.repository.com/my/project/trunk

    Khosrow
  43. Thanks for the article Aral. I wasn’t able to get the revision flag working as you have instructed however. I think the initial semicolon following -r may be incorrect syntax.

    *Instead of:*
    svn merge –dry-run -r:73:68 \ http://my.repository.com/my/project/trunk

    *Try this:*
    svn merge –dry-run -r73:68 \
    http://my.repository.com/my/project/trunk

    ferg
  44. Hi Aral,

    Great article – short, explaining, useful! Exactly what I was looking for.

    Thanks for that, and keep up the good work :)

    Cheers,
    Konstantin

    Konstantin Boyanov
  45. Thanks for sharing. This was driving me nuts trying to figure out how to get going.

    Michael Rice
  46. Thanks, quick and handy.

    Andrew Blair
  47. Very useful. The svn merge command is probably the most powerful in subversion. Love it.

    Geddon
  48. Just to make a note on ‘petke’ comment. I just want to make sure people reading this dont think you are actually correct. The way explained on this tutorial is 100% the right way to do it. Petke way is just an update to a particular version. It is not a true revert, is just updates your local copy and does not affect the repository.
    It is mainly use to viewing or grabbing past changes. I mainly use it for reverting one file at a time, as it is faster.
    svn update -r 4 (on file)
    -copy contents of r 4 of file
    svn update (repository version, lets say 10)
    -paste contents of r4 to latests
    svn commit -m ‘revert to r4′

    now you would be at r 11.

    Geddon
  49. It’s important to emphasize that any new changes you’ve made that have not committed will be lost when you merge your old revision in with your working copy.

    isam
  50. also, the syntax is -rN:N instead of -r:N:N (svn 1.6.5)

    isam
  51. Please could you update the correct commands.
    svn merge –dry-run -r73:68 http://my.repository.com/my/project/trunk
    svn merge -r73:68 http://my.repository.com/my/project/trunk

    Jimish Shah
  52. try this:

    svn up -r[insert revision #] [insert filepath]

    jeff
  53. thanks. it helped. for me though its not
    -r:73:68 but
    -r 73:68

    shridhar
  54. @pan69

    Cornerstone imo is the best Mac subversion GUI. You can do anything with it other than merging, but I prefer to do that kind of thing via cmd line anyway. It is most useful for visualizing changes, conflicts, viewing logs, etc. I like it a lot better than Versions and it is continually getting development updates especially now that it has a proper team working on it.

    danielsdesk
  55. Thanks for the instructions!
    The syntax is different for svn 1.x though. In particular:

    svn merge -r 73:68 http://my.repository.com/my/project/trunk

    lensovet
  56. Dude, your site keeps saying my comment looks like “spam”.

    Kalle
  57. Thanks Aral, very useful. Unbelieveably it’s only after five years of using Subversion that I’ve finally needed to revert to a previous reivsion. Hopefully that say something positive about my coding. Just to note that the above did work, although I had to remove the first semicolon from the revision argument:

    svn merge -r73:68 http://my.repository.com/my/project/trunk

    Jamie Saunders
  58. what’s wrong with…

    svn update -r 73

    …?

    Andrew
  59. svn merge -c -NUM .

    (svn 1.6 and onwards)

    Best of all...
  60. Thanks for the hint!
    I think the argument -r:73:68 should be -r73:68 (without the colon). I got an error with the first version.

    Rodolfo Carvajal
  61. [...] good and detailed explanation of the revert process from aralbalkan. 53.734750 [...]

    Revert or rollback a SVN revision « Magp.ie
  62. Extremely useful suggestion

    Somdas
  63. Revision syntax of merge is wrong and would fail (at least it does on Subversion 1.6.5) with svn: Syntax error in revision argument ':29:27'.

    Proper usage would be svn merge -r 73:68 http://my.repository.com/my/project/trunk.

    Ain Tohvri
  64. if you are using subclipse, here’s another option: do team > show history on your project root. in the history view, select all revisions *after* the revision to which you wish to revert (e.g., if you want to revert to 260, select 261 and up). then, right-click and do “Revert Changes from Revision x to Revision y”. Optionally, verify the changes using “Team > Compare with”. Then commit.

    colin

    colin
  65. To rollback a specific file, just delete the one in your working copy and then run update to replace it with the one in the repo.

    Ben
  66. [...] new to svn, so this was NOT intuitive for me.  Some helpful people on the interwebs (Anil and Aral Balkan) showed me that the right thing to do is “svn merge -r 4:1″ (the syntax is wrong on [...]

    Source Control Nightmare « Tales of an Ex-Googler
  67. [...] Major mistake. I went looking for a reminder on the syntax of rolling back one’s changes, and found Aral Balkan’s explanation, which is terrific for its clearness. The syntax on my machine was slightly different than his [...]

    Closer To The Ideal » Blog Archive » How to roll back your changes in Subversion
  68. For me (Mac OS X) this worked:

    svn merge -r 73:68

    and NOT

    svn merge -r:73:68

    Andri
  69. Hi,

    You made a mistake, it’s
    svn merge –dry-run -r73:68 http://my.repository.com/my/project/trunk

    svn merge -r73:68 http://my.repository.com/my/project/trunk

    There is no : between -r and the revision number.

    Regards

    NicolasB
  70. What if i want to revert the repository to a previous version but keep all my local modifications? I accidentally committed work that i wasn’t through working on locally, and i want to undo those commits.

    mike
  71. Thanks Aral for such an easy-to-understand tutorial. You actually saved my day.. Otherwise I’d have had to explain hell lot of stuff to my supervisor on why the hell did I delete the whole branch instead of just the subtree in that branch which I was working upon.. Am so damn relieved now.. I just can’t thank you enough.

    Regards

    Abhijeet Anand
  72. I a little trepidatious about doing this in general. I need to though. Sooooo, wouldn’t it be easier to just delete everything in the working copy and check out the old copy? But I guess, you are also reverting the repository version as well, on purpose?

    Dennis Gearon
  73. The revert command confused me too. Your post has been very helpful, now I am able to undo changes that I have committed. Thanks!

    Dennison Uy
  74. I think instead of “-r:73:68″ it should be “-r 73:68″

    Rastin Mehr
  75. Actually, it’s svn merge –dry-run -r 73:68 http://my.repository.com/my/project/trunk

    not

    svn merge –dry-run -r:73:68 http://my.repository.com/my/project/trunk

    (notice the -r flag).

    Carl Helmertz
  76. Such an old article, but still very usefull! I messed up our subversion website, and ‘revert’ did exactly what you described. Thanks to this article I used the correct merge (Which even removed files that were newly added.), and all is fine now. Thanks!

    Adrie
  77. I got a syntax error with these instructions – it didn’t need the first : in between -r and 73

    paul haine
  78. Didn’t notice that several people have already commented to that effect, whoops

    paul haine
  79. Thanks very much, I was worried until you cleared this up :).

    Steven
  80. your first paragraph and a half sums up the problem completely! Thanks for posting. I’ve spent a while trying to figure this one out.

    Gavin
  81. Thank you very much! That worked like a charm, explanation was good as well.

    Niels Bjerg
  82. There is a small change that needs to be done:

    The ‘:’ between r and 73 needs to be removed.

    Steps:
    1. svn merge –dry-run -r 73:68 http://my.repository.com/my/project/trunk
    2. svn merge -r 73:68 http://my.repository.com/my/project/trunk
    3. svn commit -m “Reverted to revision 68.”

    Sandeep Sripada
  83. Thanks SO much for posting this. Worked like a charm. This blog post has now saved my ass at work twice. :)

    Yonas
  84. Thanks for useful information.
    You have a little mistake: -r 73:68 instead of -r:73:68

    Kvex
  85. In the version of the subversion client I have, there is no leading colon in the revision argument, so it would be:

    svn merge –dry-run -r73:68 http://my.repository.com/my/project/trunk

    Jonathan
  86. Although the syntax wasnt exactly right (I think you’ve gort a extra colon there….) , the clearly set out simple steps was very comforting…and it worked.

    David Hallett
  87. There’s also a Revert in Subclipse for Eclipse. I don’t know if this is a Subclipse extension, or a native svn command, but it does what you’re describing here.

    David
  88. Thanks for the info. It was helpful. One note, you mistyped the revision arguments “-r:73:68″. It’s should be “-r 73:68″. Fixing it would make it easier to cut-and-past. Thanks.

    Thuy
  89. Hey your command is wrong

    its acutlaly

    svn merge –dry-run -r 73:83 file

    Note the space between -r and the revision numbers

    Trevor
  90. Why not just copy the old version from the repo to your working copy. If you’re happy with what happens, commit. I’m pretty sure this actually won’t use any extra space.

    Jonathan
  91. Looks like you have slight syntax errors: -r:73:68 should probably be -r73:68 (without the first colon), as many people have already pointed out.

    By the way, comments are somewhat hard to find, how about putting them where they usually are (below the article)?

    Ivan Vučica
  92. Thank you for blog. This helped me.

    vdevi
  93. Cool. Works like a charm!

    _
  94. Hi,

    Great article as it just solved my problem however there is one small error (for me at least) in the commands.

    Where you have “svn merge -r:73:68″ I have found that it errors, unless you remove the semi-colon behind -r and replace it with a space. So it I found it should be

    svn merge -r 73:68 http://location

    - Jonny (@DevJonny)

    Jonny Olliff-Lee
  95. Really helpful, thank you!

    Donal
  96. Thanks for your great tutorial!
    the -r parameter is not correct, however. it should be -r 73:68
    You need a space instead of a colon. Maybe this is a result of an update to subversion.
    svn merge –dry-run -r:73:68

    Robert Nelson
  97. Could you not just do…

    $ svn switch http://my.repository.com/my/project/tags/previous_tag

    Philip Thompson
  98. Thanks! This is exactly I’ve been looking for!

    Just simple and step-by-step.

    Ed
  99. you have a syntax error:

    -r:73:68

    should be

    -r 73:68

    Nick
  100. Hi,

    I think you made a typo.

    It should be “svn merge -r 73:68″ with a space after “-r” instead of a “:”.

    Kind regards,
    Gijs

    Gijs
  101. You need to delete the : between -r and the r number or you get an error. ie:

    svn merge –dry-run -r 73:68 http://my.repository.com/my/project/trunk

    adrianbj
  102. Is there a mistake?
    If I remove “:” after -r it works:
    svn merge –dry-run -r 73:68 http://my.repository.com/my/project/trunk

    Vlad
  103. Thanks, useful

    Panikos
  104. “this is a no-brainer in TortoiseSVN (view change log, right-click the revision I want to roll back to and select “Revert to this revision”). It does everything necessary under the hoods.”

    Nope. That doesn’t roll it back on the server; only locally. Just tried this an hour ago and pissed off some teammates who were waiting for the rollback.

    What Haveyou
  105. -r73:68, not -r:73:68

    mc
  106. It failed for me, I needed to drop the first colon after the -r

    Ian Hickman
  107. Oh, and no-one reads comments that are on the right-hand side of the page, that’s why several people have posted exactly the same fix!

    Ian Hickman
  108. Thanks for this, I have been trying to revert to a previous version in our repo but couldn’t do so. It was only displaying Skipped (version #)

    Jeune
  109. I appreciate the plain English, but the syntax is not quite right, as has been mentioned by several other commenters. Can you correct your post, please?

    Bill Milligan
  110. Works perfectly! Thanks! :)

    Just one fix : revision option has to be expressed as ‘-r73:68′ (without ‘:’ after ‘-r’, ‘-r:73:68′ generates a syntax error on my configuration (svn 1.4.2).

    Idomeneo
  111. Thanks Aral,
    Mate youve got an extra in your command by my svn …

    svn merge -r 73:68
    .. rather than ..
    svn merge -r:73:68

    Have fun,
    Eugene.

    Eugene Kerner
  112. Thanks, this was a life-saver after I completely messed up the trunk with an accidental bad commit.

    Just a note though, I don’t know if this is version difference or something else (I see that this was written nearly 3 years ago), but my svn reported a syntax error in revision argument when written in the form -r:13:12. Instead, it was supposed to be written in the form -r13:12 (just removing an extra column after ‘r’).

    Nikola
  113. If you just want to bring your local copy back to a past version just use:

    svn up -r

    Dave
  114. Perfect. Exactly what I was looking for.

    Cheers.

    Harsha
  115. > you merge the changes from your current revision back to the revision you want to revert to.

    I think a better way to say it is
    you merge the previous revision into your working copy, and then commit those changes to the repository

    James
  116. So this has been here a few years, but still came in handy to get me out of serious jam. Thanks!

    Karl
  117. Thanks Aral,

    This meets the user’s needs while maintaining full visibility but what about the actual repository itself? I have an svn mirror that got out of sync ( long story ) and literally need to prune off the last revision. Is there no simple solution other than svnadmin dump and rebuild?

    Thanks,
    … Robert Rath

    Robert Rath
  118. [...] via Aral Balkan · How to revert (roll back) to a previous revision with Subversion. [...]

    Aral Balkan · How to revert (roll back) to a previous revision with Subversion « ontheeasiestway
  119. On subversion right click – there is revert to this revision option. What will happen when we click that ?

    rudraksha
  120. you saved my life today (more or less)

    :D

    jmanuel
  121. Hi, there’s a tiny mistake in this page, the command ii should be svn merge -r 73:68 http://my.repository.com/my/project/trunk (ie no “:” between “-r” and “73:68″)

    Mick
  122. Thanks, just what I needed. I think there shouldn’t be a colon after the -r switch though – only between the two revision numbers:

    -r 73:68

    Jim McIntyre
  123. thank u so much dear friend

    manoj
  124. Thanks, this was exactly what I was looking for in an SVN project I’m working on. One small change. The -r:#:# format did not work for me. Instead, I had to do -r#:#. Note that the colon immediately following the r had to be removed.

    Sean
  125. The right command should be:
    svn merge -r73:68

    hadv
  126. this helped me real quick! thanks.

    mka
  127. Very helpful, the inly hangup I ran into was a command error where you wrote -r:73:68

    I had to remove the first semi-colon for it to work and used -r73:68 or -rHEAD:68 to refer to the most recent revision.

    Again, super helpful though, thanks.

    Scott
  128. Does it include the folder’s properties, like svn:ignore ?

    Adrien
  129. There is a typo in the command line
    (a colon after the ‘-r’ option)

    WRONG:
    svn merge –dry-run -r:73:68

    CORRECT:
    svn merge –dry-run -r 73:68

    Dmitri
  130. It seems that the options for r have to be given without the first colon.
    That is
    svn merge –dry-run -r 73:68 http://my.repository.com/my/project/trunk

    JuanPi
  131. Slight typo:
    svn merge –dry-run -r 73:68 http://my.repository.com/my/project/trunk
    then
    svn merge -r 73:68 http://my.repository.com/my/project/trunk

    David
  132. So funny. I didn’t even notice that the content on the right hand side are the comments.

    I naturally assumed that comments appear below the article and/or comment box.

    David
  133. Your instructions are somewhat wrong.

    They should be:

    -rxxx:yyy

    Or to rollback from current head (working version) to an older one:

    -rHEAD:yyy

    or

    -c -yyy

    Where yyy is the previous version.

    Marked One
  134. This really helped; as mentioned we don’t have to many places with precise info.

    A B
  135. Thanks but the revision argument should be passed like -r73:68. You’ve got an extra colon in there.

    Hamid
  136. good document.

    ommrudraksha
  137. None of the examples work – all yield:

    “svn: Syntax error in revision argument ‘:72:71′”

    Ned Seagoon
  138. I think the sintax changed to

    svn merge -r73:68

    without “:” between r and the first revision number.

    john
  139. Hey Aral,

    Thanks for this, I spend lots of my time to search this. I was thinking that revert command is for this purpose but…:(… no . This blog is very very useful Thanks once again….. :)

    – Yogesh

    Yogesh
  140. Git is very cool. Been using it for almost a year now.

    svn rollbacks I do by checking out the previous version into a sandbox. Then I use ‘meld’ to visually compare and merge the 2.

    Rijk Stofberg
  141. Thanks
    -r:73:68 should be -r73:68
    (at least in my svn, version 1.6.12 (r955767))

    Rod McLaughlin
  142. s/-r:73:68/-r 73:68/

    Flimm
  143. You should consider putting the comments in the more traditional location of just below the blog post. As you can see, a bunch of us assumed the sidebar had unrelated comments, and a bunch of us all corrected the same mistake.

    Flimm
  144. That is quite helpful. But on your local file, you can do :
    svn up -r revisionNumber TheFileYouWantToRevert

    It works pretty good to. :-)

    Rem's
  145. Thanks for posting this. Was very helpful.

    Ankit Jhalaria
  146. Thanks, Very Nice steps

    Avinash Pawar
  147. What if I want to revert to a previous version that was deleted and can’t merge?

    Gus
  148. that should be “svn merge -r73:86″
    (you have an extra colon in your post)

    izar
  149. Great !. Very good explanation. Thanks.
    ( A small correction in the following line
    “svn merge –dry-run -r:73:68″
    I think the “:” will not follow “-r” )

    Shankari
  150. Thanks, saves me time figuring out how to do just this…

    However, at least on my version of SVN, the “-r” command should look like “-r 73:68″ not “-r:73:68″

    David
  151. i think the correct command is
    svn merge -r 73:68 http://my.repository.com/my/project/trunk

    ionut
  152. btw didn’t see the comments on the right, thought there were no comments :)

    ionut
  153. Thank you for the nice article, but I do believe there is a typo in it. It should be “-r 73:68″, not “-r:73:68″.

    Tolga AKIN
  154. Thanks for this post, it’s indeed quite weird to use the merge for this, but it works fine!

    Little syntax error: remove the ‘:’ after the -r, it should just be a space.

    Erik
  155. If I had not found this I would have ended up trying all kinds of functions in SVN before even considering to use merge in reverse.

    Thank you for the precise and to the point blog post.

    Oyvind
  156. i think you have a syntax error.

    the -r flag shouldn’t have a ‘:’ right after it.
    i think it should be -r 73:68

    mike
  157. Thanks for this hint :)

    I know this post is a few years old, but there is still one thing to correct: There has to be a space after “-r”.
    So it would be “svn merge -r 73:68…”

    illo
  158. Error in your code:

    svn merge –dry-run -r:73:68

    should be

    svn merge –dry-run -r73:68

    Mitch Robertson
  159. If you get a:

    svn: Syntax error in revision argument ‘:73:68′

    … with the above -r:73:68 statements, then try -r 73:68 instead of -r:73:68

    Another useful command in dealing with revisions is to be able to checkout a specific revision number (e.g.68):

    svn co –username [username] –password [password] svn://my.repository.com/my/project/trunk@68

    … or …

    svn co -r 68 –username [username] –password [password] svn://my.repository.com/my/project/trunk

    Steven J. Garner
  160. Thanks, made my day!

    Mohammad Khashashneh
  161. Great info, well written. Thanks!

    Mauritz Hansen
  162. While this is the first Google result if I want to revert something, it still has a minor error, so that this does not work.

    The correct syntax for svn revisions is not -r:123:456 but -r 123:456

    Else, thanks for the solution. It’s easier to Google this once a year when you need it than to memorize it :-)

    Stefan
  163. Though this is extremely old, I found the command

    svn update -r 68

    to be more to my liking. Hope this helps someone!

    Alex
  164. SVN sucks GIT rules.
    I was “forced” to use SVN for my current project and I’ve been wasting hours trying to make things like this work rather than working.

    Vibhor