Merging Source Control Files—Subversion

There may be times when you need to merge changes from different authors when committing a file. The merge occurs automatically if there are no conflicting changes (i.e., changes do not occur in the same location in the file). If there are conflicting changes, a dialog opens, allowing you to determine how changes are merged.

How to Merge Source Control Files

  1. Go through the process of updating files from source control or committing files. See Updating Source Control Files—Subversion and Committing Source Control Files—Subversion. If your local copy of the file is different from the server copy (e.g., another author has already committed the same file), the Resolve Conflicts dialog opens.
  2. Click Auto Merge All. If changes from the other author do not conflict with your changes, this will merge all changes. A message lets you know that a backup of your local copy has been made. This lets you restore that file if you do not want to keep the merged version (see Backups) . You do not need to complete the rest of the steps below.

    However, if your changes conflict with those from another author, a message displays to tell you. In this case, continue with the next step.

  3. Click OK on the conflict message.
  4. In the Resolve Conflicts dialog click Resolve. The Resolve Version Conflict dialog opens. From this dialog, you can choose from the following options.
    • Merge changes for me Automatically merges changes within the same file that are not part of the same element. If changes have been made to the same element (e.g., the same <p> tag or <h1> tag), Flare will display a prompt to merge the changes using the merge tool.
    • Merge changes in merge tool Opens a merging interface, which lets you see exactly what changes were made and choose which to keep.
    • Undo my local changes Automatically removes your changes and keeps changes from other authors.
    • Discard external changes Automatically removes changes from other authors and keeps your changes.
  5. If you selected the option to use the merge tool, the Merge Changes dialog opens. Use this dialog to view and select changes. You can take actions in the following ways.
    • Click a change You can click a change on either the remote or local side. This lets you select a particular change. Use the key at the top of the merge changes dialog, as well as the color coding on the local and server sides, to determine if a change has been added (new), deleted, changed, or moved.When you select a change, the change you selected will display with a solid colored background, and the conflicting change will display with a striped background. If you select the other change, the background shading will switch.

    • Type content If you want to use your changes as well as those from another author, and even tweak the paragraph a bit more, you can click in the area at the bottom of the dialog and simply type content.
    • Previous/next conflict When you are finished resolving the first conflict, you can use the "Previous Conflict" and "Next Conflict" buttons at the bottom of the dialog to work on other conflicts in the file.

    Note If you selected "Merge as Text" in the local toolbar and are working in the code, you can click on text with a hatched background to keep the change in it. After you click on text with a hatched background, the hatched lines are removed, leaving a solid color.

  6. After all conflicts have been resolved, a message lets you know that a backup of your local copy has been made. This lets you restore that file if you do not want to keep the merged version. Click OK.

Example — Auto Merging

Let's say two authors —Bob and Jill—are working on the same project, using source control to manage the files.

Bob checks out the "FAQs" topic and starts making changes to it.

Jill also checks out the "FAQs" topic and makes some changes to it. Jill's changes are in a different location in the topic than Bob's changes; there are no conflicts. She finishes before Bob and submits the file to source control.

Bob finishes his changes and tries to submit the file. Before the file can be submitted, Bob is prompted with a dialog, indicating that changes from another author have already been submitted.

Bob selects Auto Merge All. The changes from Bob and Jill are now both shown in the merged topic.

Example — Conflicting Changes

Two authors—Bob and Jill—are working on the same project, using source control to manage the files.

Bob starts making changes to the "FAQs" topic.

Jill also makes some changes to the "FAQs" topic. Jill's changes are in the same paragraph in the topic as Bob's changes; thus, there is a conflict. She finishes before Bob and commits the file to source control.

Bob finishes his changes and tries to commit the file. Before the file can be committed, Bob is prompted with a dialog, indicating that changes from another author have already been committed.

Bob selects Auto Merge All. However, he receives another message, stating that his changes conflict with those of Jill.

Bob clicks OK. Then in the Resolve Conflicts dialog he clicks Resolve. This opens the Resolve Version Conflict dialog. From this dialog, Bob can choose from a few different options.

Bob selects Merge changes in merge tool. The Merge Changes dialog opens.

So what action can Bob take at this point for merging the file changes?

Bob can right-click on the icon next to the change on either the local or server side. This displays a context menu, which lets Bob either keep or ignore a particular change.

Another way of accomplishing the same thing is to left-click on an icon. When you do this, the change from one side is kept and the change from the other side is ignored. If you left-click the icon again, the results are toggled; the first change is ignored and the other is kept.

What if Bob wants to use his changes as well as Jill's, and possibly tweak the paragraph a bit more? He can click in the area at the bottom of the dialog and simply type content.

When he is finished resolving the first conflict, Bob can use the "Previous Conflict" and "Next Conflict" buttons at the bottom of the dialog to work on other conflicts in the file.

After all conflicts have been resolved, Bob clicks OK. The merged topic is now committed to source control.