How to Resolve Conflicts in Apache Subversion

When you are performing a commit in Apache Subversion, you may occasionally encounter the dreaded Subversion conflict, and your commit will fail. A lot of drama is made about conflicts in version control, but thankfully, Subversion has the functionality to guide you through resolving merge conflicts when they do occur. In this post, we will look at resolving a conflict using the popular TorotiseSVN Subversion client for Windows.

Steps

  1. Image titled Resolve Conflicts in Apache Subversion Step 1
    1
    Once you have finished making changes to your working copy, it is time to commit your changes back to the repository! Select ‘SVN Commit.’
  2. Image titled Resolve Conflicts in Apache Subversion Step 2
    2
    Usually, this is all that’s needed to commit your changes back to the repository but, if another member of your team has committed an updated version of the file in question, TortoiseSVN will warn you that your working copy is out of date.
  3. Image titled Resolve Conflicts in Apache Subversion Step 3
    3
    Click ‘OK’ and TortoiseSVN will ask whether you wish to run ‘SVN Update.’ Select the ‘Update’ button.
  4. Image titled Resolve Conflicts in Apache Subversion Step 4
    4
    Sometimes this is all that's required to resolve a conflict but, if you have modified the exact same part of the exact same file as your teammate, TortoiseSVN will warn that one or more of your files are in a conflicted state.
  5. Image titled Resolve Conflicts in Apache Subversion Step 5
    5
    To resolve the conflict, open the corresponding folder in your working copy. You will see three new versions of the conflicted file: the file with the highest numbered extension is the repository’s most recent file; the file with the lower revision number is your local file; and ‘filename.mine’ is the file as it existed in your working copy, before you performed an update.
  6. Image titled Resolve Conflicts in Apache Subversion Step 6
    6
    Use the original file to manually merge the changes between the repository’s version and your local version.
  7. Image titled Resolve Conflicts in Apache Subversion Step 7
    7
    When you have finished, delete all the duplicates.
  8. Image titled Resolve Conflicts in Apache Subversion Step 8
    8
    Right-click on the file and select ‘SVN Commit...’
  9. Image titled Resolve Conflicts in Apache Subversion Step 9
    9
    Your modified file will now successfully be committed to the repository!

Things You'll Need

Article Info

Categories: Web Programming