[ACCEPTED]-Rolling back bad changes with svn in Eclipse-subversive

Accepted answer
Score: 80

In Eclipse Ganymede (Subclipse)

Select project/file 40 that contains bad change, and from pop-up 39 menu choose:

Team -> Show History

Revisions related to that project/file 38 will be shown in History tab.

Find revision 37 where "bad changes" were committed and from 36 pop-up menu choose:

Revert Changes from Revision X

This will merge changes 35 in file(s) modified within bad revision, with 34 revision prior to bad revision.

There are 33 two scenarios from here:

  1. If you committed 32 no changes for that file (bad revision is 31 last revision for that file), it will simply 30 remove changes made in bad revision. Those 29 changes are merged to your working copy 28 so you have to commit them.

  2. If you committed 27 some changes for that file (bad revision 26 is not last revision for that file), you 25 will have to manually resolve conflict. Let 24 say that you have file readme.txt with, and 23 bad revision number is 33. Also, you've 22 made another commit for that file in revision 21 34. After you choose Revert Changes from Revision 33 you will have following 20 in your working copy:

readme.txt.merge-left.r33 - bad revision

readme.txt.merge-right.r32 19 - before bad revision

readme.txt.working - working 18 copy version (same as in r34 if you don't 17 have any uncommitted changes)

Original readme.txt 16 will be marked conflicted, and will contain 15 merged version (where changes from bad revision 14 are removed) with some markers (<<<<<<< .working 13 etc). If you just want to remove changes 12 from bad revision and keep changes made 11 after that, then all you have to do is remove 10 markers. Otherwise, you can copy contents 9 from one of 3 files mentioned above to original 8 file. Whatever you choose, when you are 7 done, mark conflict resolved by

Team - Mark Resolved

Temporary 6 files will be removed and your file will 5 be marked changed. As in 1, you have to 4 commit changes.

Note that this does not remove 3 revision from revision history in svn repository. You 2 simply made new revision where changes from 1 bad revision are removed.

Score: 30

You have two choices to do this.

The Quick 12 and Dirty is selecting your files (using 11 ctrl) in Project Explorer view, right-click 10 them, choose Replace with... and then you choose the best 9 option for you, from Latest from Repository, or some Branch version. After 8 getting those files you modify them (with 7 a space, or fix something, your call and 6 commit them to create a newer revision.

A 5 more clean way is choosing Merge at team menu 4 and navigate through the wizard that will 3 help you to recovery the old version in 2 the actual revision.

Both commands have their 1 command-line equivalents: svn revert and svn merge.

Score: 14

If you want to do 1 file at a time you can 8 go to the History view for the file assuming 7 you have an Eclipse SVN plugin installed. "Team->Show 6 History"

In the History view, find the last 5 good version of that file, right click and 4 choose "Get Contents". This will replace 3 your current version with that version's 2 contents. Then you can commit the changes 1 when you've fixed it all up.

Score: 7

In Eclipse using Subversive:

Right click 4 your project > Team > Merge

In the merge 3 window, select the revisions you want to 2 revert as normally but also enable checkbox 1 "Reversed merge".

Merge as normally.

Score: 5

I have written a couple of blog posts on 2 this subject. One that is Subclipse centric: http://markphip.blogspot.com/2007/01/how-to-undo-commit-in-subversion.html and 1 one that is command-line centric: http://blogs.collab.net/subversion/2007/07/second-chances/

Score: 1

The svnbook has a section on how Subversion 15 allows you to revert the changes from a 14 particular revision without affecting the 13 changes that occured in subsequent revisions:


I 12 don't use Eclipse much, but in TortoiseSVN 11 you can do this from the from the log dialogue; simply 10 right-click on the revision you want to 9 revert and select "Revert changes from 8 this revision".

In the case that the 7 files for which you want to revert "bad 6 changes" had "good changes" in 5 subsequent revisions, then the process is 4 the same. The changes from the "bad" revision 3 will be reverted leaving the changes from 2 "good" revisions untouched, however 1 you might get conflicts.

Score: 0

I have same problem but CleanUp eclipse 5 option doesn't work for me.

1) install TortoiseSVN 4
2) Go to windows explorer and right click 3 on your project directory
3 Choice CleanUp 2 option (by checking break lock option)

It's 1 works.

Hope this helps someone.

More Related questions