blob: a2c373e57b66f3066b45413d653cb7dce3cf8f51 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">
<head>
<meta name="copyright" content=
"Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" type="text/css">
<title>Resolving conflicts</title>
<meta name="keyword" content="team">
</head>
<body bgcolor="#FFFFFF">
<h1>Resolving conflicts</h1>
<p>When updating or committing you may encounter conflicts. A conflict occurs when you have locally modified a
resource for which a more recent revision is available in the branch in the repository. Specifically, the branch will
contain a revision newer than the base revision of your resource. In this situation you can choose to do one of the
following:</p>
<ul>
<li>You can take the change from the branch, discarding your local work. This could occur if you have made
unintended changes locally, or if you realize that the revision in the repository is better than yours. Overwriting
your local changes should be done with caution since you are in essence throwing work out.</li>
<li>You can commit your change, subsuming the revision in the repository. This should be done with great caution
since you are in essence throwing away someone else's work. In particular, the change you are overwriting may have
other dependencies in the branch (for example there may be other incoming changes which depend on the
conflict).</li>
<li>You can merge your work and the repository resource, saving locally the merged resource. You may then later
choose to commit this merged result.</li>
</ul>
<p>Typically, you will want to take the third option, that is to merge, because of the loss of work issues with the
other two choices.</p>
<h2><a name="MergingChanges" id="MergingChanges">Manually merging changes</a></h2>
<p>The Synchronize View indicates those resources which are in conflict with the branch. For a given resource in
conflict, typically you will want to merge your changes with changes in the branch's resource.</p>
<p class="Para">For example, let us assume that both you and another team member have modified the same html page.
Opening that resource from the Synchronize view will display a comparison of the local resource and the branch
revision. By cycling through and merging the individual changes, you can decide for each change whether to accept the
incoming change, reject it, or merge it with your local changes. When you are finished merging, you save your
changes. This overwrites your local resource with the result of the merge. You can subsequently commit this merged
resource.</p>
<p><em>Tip:</em> When merging changes, it is often convenient to be able to distinguish which files you have
completed merging. When you're done merging a file, you can pick <b>Mark as Merged</b> from the context menu. This
will change the status of the file from being a conflict to being an outgoing change.</p>
<p>You can merge differences in the Synchronization view on two levels:</p>
<ul>
<li><b>Whole Document</b> - In the Synchronize view, open the resource that you want to merge in a Compare editor.
In the Compare editor, click the Copy all non-conflicting Changes from Right to Left button to copy all
non-conflicting changes. Conflicting changes will have to copied individually.</li>
<li><b>Current Change</b> - In the Text Compare editor, either use the Go to Next Difference and Go to Previous
Difference buttons to navigate to the change that you want to merge, or simply click in either source pane
somewhere in the desired change difference fragment. Click the Copy current change from right to left button as
needed to overwrite the highlighted fragment either with the corresponding modification in the branch.</li>
</ul>
<h2><a name="AutoMergingChanges" id="AutoMergingChanges">Auto merging changes</a></h2>
<p>It is also possible to have your changes automatically merged for you. For any resource marked as ASCII,
performing a <b>Team &gt; Update</b> will automatically merge into your local resource differences with the branch
resource. This works fine provided there are no lines with conflicting changes. If there are, VCS inserts special
markup in the file to indicate those lines which could not be merged.</p>
<p>Updating from within the Synchronization view works a bit differently. In the case of a conflict,
<strong>Update</strong> will only process files whose contents contain no conflicts. Files that have content
conflicts will be skipped and left in the Synchronize view as conflicts.</p>
<h3 class="related">Related concepts</h3>
<a href="../concepts/concepts-29.htm">Three way comparisons</a>
<h3 class="related">Related tasks</h3><a href="tasks-115.htm">Synchronizing with the repository</a><br>
<a href="tasks-114.htm">Committing</a><br>
<a href="tasks-68.htm">Comparing resources</a><br>
<a href="tasks-68dg.htm">Merging changes in the Compare editor</a>
<h3 class="related">Related reference</h3><a href="../reference/ref-25.htm">Compare editor</a>
</body>
</html>