How To Resolve Conflicts with Subversion Using TortoiseSVN

You run an Update on the folder that contains the files you've just changed. You want to make sure you have the latest version of the files from the repository, before you Commit your changes. And then you find you have some files in Conflict. This is what you do to resolve the conflicts.

This information was obtained from the Tortoise Plugin's Help option, in case you want to read it direct from the source. But oddly enough, Conflict resolution only works with the TortoiseSVN in Windows Explorer, not the plugin.

When a conflict is reported, three text files are created within the directory that the file in conflict exists. Don't worry about those for now, just know that they are there.

Here is what you should do - open the file that is in conflict. You will see some additional code has been added.

When you see <<<<<<<< That marks where the conflict starts and represets YOUR version of the code. Then you will encounter ======== which divides YOUR version, above the line, with the Repository version, below the line. Then the conflict ends with >>>>>>> and a revision number.

All you have to do is change the file the way you want it. If code was added to the file that isn't in your version, then include it and comment it out. It'll all get merged together and you or another developer who added the code you're commenting out can decide if that code is necessary or not.

Remember if you make a mistake and get rid of someone else's code, all is NOT lost. You can save a copy of the file to your desktop, for example, and revert the original back to the previous version, thus restoring the code that was once lost - then copy and paste from your desktop copy to the reverted copy to make the file right. Then Commit it to the repository.

When the files are saved and represent the way the code should be, you should close them in Eclipse. You will have to go outside of Eclipse to complete the Conflict cycle, because the option you need in Tortoise is not in the Eclipse plugin.

Open Windows Explorer and file your local copy of the site. If you right click the directory the files in conflict are in, then this one action will fix them all, otherwise if you right click on a specific file only that file gets resolved.

So right click (on a folder or file) and go to Tortoise>Resolved.... It brings up a dialog box much like the Commit box, asking if the file(s) listed are Resolved. You say OK and Subversion resolves the conflicts and removes those pesky text files too.

Now right click on the site folder and select SVN Commit... to commit your file changes.

Ahhhh, all is well.

Comments
GB's Gravatar Err, Eclipse (with both Subclipse and Subversive) does have the option to mark the conflict as resolved, and has for ages.
# Posted By GB | 10/3/07 12:25 PM
Jim Pickering's Gravatar I don't recall covering Subclipse or Subversive in this post. It is covering TortoiseSVN stand-alone and the Tortoise plug-in for Eclipse. There is no option to Resolve a Conflict in the Tortoise Plugin.
# Posted By Jim Pickering | 10/3/07 12:52 PM
hamy's Gravatar Since TSVN 1.5 came out there are some minor changes. Here is a nice link to quick videos showing how to use basic TSVN features. Hope it helps you as well.

http://pollvu.blip.tv/

hamy
# Posted By hamy | 7/12/08 5:45 PM
Copyright ©2007 JimPickering.com. Some rights reserved. BlogCFC was created by Raymond Camden. This blog is running version 5.1.004.