Search code examples
svnbranchrevert

SVN How to revert changes from a feature branch


I had created a feature branch and committed there several times. I need to revert some files as if I've never touched them in my feature branch. In other words I don't want to reintegrate them back.

How can I do this?


Solution

  • If I understood correctly, your situation is following:

    1. You've created a featured branch:

      $ svn cp ^/trunk/ ^/branches/feature
      
    2. You've did some work on ^/branches/feature and commited.

      $ ... work, work, work ...
      $ svn ci
      
    3. Now you want to undo some changes.
      So, do a reverse merge.
      First, check which revisions you want to undo using svn log:

      In your featured branch working copy:
      $ svn log -v 
      -----------------------------------
      r234 ...
      Changed paths:
      M /branches/featured/file.c       
      
      Implemented a feature
      -----------------------------------
      
    4. Reverse-merge the specific revision(s). Note the - before the revision:

      $ svn merge -c -234 .
      
    5. Reintegrate to the trunk:

      In the trunk working copy:
      $ svn merge --reintegrate ^/branches/feature .