Monday, January 23, 2012

SVN Revert (but only *some* changes)

Sometimes I endeavor in complicate refactorings and, instead of commiting to a branch when at least a part is working, I keep editing until I lose control of the source and wished that I could go back to that previous working situation.

The solution is, luckily, not too difficult:

  1. save the edits to a patch
    svn diff > great_mother_of_all_patches.patch
  2. revert the project to the last commit:
    svn revert -R .
  3. apply the patch edit by edit (I know this is tedious) using the eclipse "Team Synchronizing" perspective, then click on the Synchronize button and choose the Synchronize with patch option
Disclaimer: I don't use the Eclipse subversion plugin because, on Linux at least, it frequently crashes Eclipse.

No comments: