Sunday, July 25, 2010

Resolving SVN Tree Conflicts

The Red Bean SVN Book has a good explanation of how to fix Tree Conflicts in the chapter Dealing with Structural Conflicts.  Basically, this happens because one developer has made a change to a file or directory that another user has deleted or renamed.  The svn status command will indicate which file is at issue:
C:\testrepos>svn st
M       baz.cs
M       foo.cs
A  +  C bar.cs
      >   local edit, incoming delete upon update
The "C" in column 5 next to bar.cs indicates a tree conflict, namely that this file has been renamed by another user.
To resolve this, do an SVN UPDATE, which will bring in the renamed version, apply your changes to this version, use SVN REMOVE to delete bar.cs, and finally, let SVN know that the conflict is resolved with this command:
svn resolve --accept=working bar.cs
This lets Subversion know that the change we made to bar.cs, namely deleting it, should be propagated up to the repository. Finally, do a commit to mark the change complete.

UPDATE: We moved to GIT, so these are now a distant memory. Git can handle this scenario cleanly.


  1. This is a good tip, for a full tutorial on resolving SVN conflicts check this out:

  2. Thank you! I looked for quite a while to find this.

  3. Fantastic, worked like a charm! Thanks a lot!