What is the best way to roll-back a change set using Subversion?

前端 未结 8 1168
遥遥无期
遥遥无期 2021-02-07 10:13

I\'ve been using various source control systems for a while, but when it comes to reverting changes I\'m not yet an expert. Can someone help given this scenario:

Scenar

相关标签:
8条回答
  • 2021-02-07 10:33

    To read up on the details see: svn manual - Undoing Changes

    As described by mark you'll want to do:
    svn merge -r 5:4 file1 file2
    This means merge in the change from 4 to 5 backwards ie. undo the changes

    You could also type:
    svn merge -c -5 file1 file2
    This means apply the change that took place in commiting revision 5 backwards.

    Next you should manually review the changes.

    Finally you must commit the changes (above merges only changed your working copy).

    0 讨论(0)
  • 2021-02-07 10:35

    I think you need to reverse merge first between 5:4, then revert the correct file

    1. svn merge -r 5:5 http://svn.example.com/repos/calc/trunk

    2. svn revert correctfile

    you probably end up with at weird state on the 2buggy files That you can hopefully can solve manually.

    0 讨论(0)
  • 2021-02-07 10:39

    Here is a link to svn book explaining all about reverts and history.

    To do a diff you would do something like svn diff -r 4:5 somefile.txt

    0 讨论(0)
  • 2021-02-07 10:40

    If you are using http://tortoisesvn.tigris.org/ then this is a rather simple process. Just right click on a file and select "log" to get a list of changes between now and a selected reversion. Then it is a matter of reverting the two files to revision #4 and committing the changes :)

    0 讨论(0)
  • 2021-02-07 10:43

    check out current version, then svn merge -r 5:4 file1 file2 (that's from memory, and might not be totally correct)

    0 讨论(0)
  • 2021-02-07 10:51

    I assume you are using TortoiseSVN in my answer.

    I don't think your scenario will lead to a roll-back of the files, because you still want to preserve the history of each file. Most of the time, what you are going to do is just find and fix the bug and commit a new change to this file.

    If you want to compare two revision, it's pretty easy in tortoiseSvn, right click on the file, then go in TortoiseSvn->Show Log. Then select both the revision you want to compare, right click and then Compare Revisions.

    If you want to find who is responsible for the bug, you can use the menu item Blame in TortoiseSVN... This will let you know who modified each line and at which revision.

    Oh and if you want to revert a file back to a previous version, you can do so in TortoiseSvn->Show Log an then you select the revision you want to revert to, right click and select Revert to this revision.

    0 讨论(0)
提交回复
热议问题