| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> |
| <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=ISO-8859-1"> |
| <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">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">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 > 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, CVS |
| 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> |
| |
| <P> <img border="0" src="../images/ngrelc.png" alt="Related concepts" ><br> |
| <a href="../concepts/concepts-26.htm">Team programming with CVS</a><br> |
| <a href="../concepts/concepts-30.htm">Synchronizing with a CVS repository</a><br> |
| <a href="../concepts/concepts-29.htm">Three way comparisons</a> |
| </P> |
| |
| <p><img border="0" src="../images/ngrelt.png" alt="Related tasks" ><br> |
| <a href="tasks-115.htm">Synchronizing with the repository</a><br> |
| <a href="tasks-113.htm">Updating</a><br> |
| <a href="tasks-114.htm">Committing</a><br> |
| <a href="tasks-100b.htm">Merging from a branch</a><br> |
| <a href="tasks-68.htm">Comparing resources</a><br> |
| <a href="tasks-68dg.htm">Merging changes in the Compare editor</a> |
| </p> |
| |
| <p><img border="0" src="../images/ngrelr.png" alt="Related reference" ><br> |
| <a href="https://www.cvshome.org/docs/manual/cvs-1.11.16/cvs_10.html#SEC84" target="_blank">www.cvshome.org: Bringing a file up to date</a><br> |
| <a href="https://www.cvshome.org/docs/manual/cvs-1.11.16/cvs_10.html#SEC85" target="_blank">www.cvshome.org: Conflicts example</a> |
| <br><a href="../reference/ref-25.htm">Compare editor</a> |
| </p> |
| |
| |
| |
| </BODY> |
| </HTML> |