Resolve SVN Source Control Conflicts
Examining and Resolving Conflicts
If you and another user change the same file in different sandboxes or on different branches, a conflict message appears when you try to commit your modified files. Follow the procedure Resolve Conflicts to extract conflict markers if necessary, compare the differences causing the conflict, and resolve the conflict.
To resolve conflicts you can:
Use the Comparison Tool to merge changes between revisions.
Decide to overwrite one set of changes with the other.
Make changes manually by editing files.
For details on using the Comparison Tool to merge changes, see Merge Text Files.
After you are satisfied with the file that is marked conflicted, you can mark the conflict resolved and commit the file.
Look for conflicted files in the Current Folder browser.
Check the SVN status column for files with a red warning symbol , which indicates a conflict.
Right-click the conflicted file and select Source Control > View Conflicts to compare versions.
Examine the conflict. A comparison report opens that shows the differences between the file and the version of the file in conflict.
Use the Comparison Tool report to determine how to resolve the conflict.
You can use the Comparison Tool to merge changes between revisions, as described in Merge Text Files.
When you have resolved the changes and want to commit the version in your sandbox, in the Current Folder browser, right-click the file and select Source Control > Mark Conflict Resolved.
Commit the modified files.
Merge Text Files
When comparing text files, you can merge changes from one file to the other. Merging changes is useful when resolving conflicts between different versions of files.
If you see conflict markers in a text comparison report like this:
You can merge only from left to right. When comparing to another version in
source control, the right file is the version in your sandbox. The left file is
either a temporary copy of the previous version or another version causing a
Observe the file paths of the left and right file at the top of the comparison
report. Merge differences from the left (temporary copy) file to the right file
to resolve conflicts.
In the Comparison Tool report, select a difference in the report and click Replace Content. The selected difference is copied from the left file to the right file.
To undo the content replacement, click Undo.
Alternatively, use the inline Replace Content and Undo icons.
The merged file name at the top of the report displays the dirty flag (
) to show you that the file contains unsaved changes.
Click Accept & Close to save the merge changes and mark the conflicts resolved.
Extract Conflict Markers
What Are Conflict Markers?
Source control tools can insert conflict markers in files that you have not registered as binary (e.g., text files). You can use MATLAB® to extract the conflict markers and compare the files causing the conflict. This process helps you to decide how to resolve the conflict.
Register files with source control tools to prevent them from inserting conflict markers and corrupting files. For more information, see Register Binary Files with SVN. If your files already contains conflict markers, the MATLAB tools can help you to resolve the conflict.
Conflict markers have the following form:
<<<<<<<["mine" file descriptor] ["mine" file content] ======= ["theirs" file content] <<<<<<<["theirs" file descriptor]
If you try to open a file containing conflict markers, the Conflict Markers Found dialog box opens. Follow the prompts to fix the file by extracting the conflict markers. After you extract the conflict markers, resolve the conflicts as described in Examining and Resolving Conflicts.
To view the conflict markers, in the Conflict Markers Found dialog box, click Load File. Do not try to load files, because MATLAB does not recognize conflict markers. Instead, click Fix File to extract the conflict markers.
MATLAB checks only conflicted files for conflict markers.
Extract Conflict Markers
When you open a conflicted file or select View Conflicts, MATLAB checks files for conflict markers and offers to extract the conflict markers. MATLAB checks only conflicted files for conflict markers.
However, some files that are not marked as conflicted can still contain conflict markers. This can happen if you or another user marked a conflict resolved without removing the conflict markers and then committed the file. If you see conflict markers in a file that is not marked conflicted, you can extract the conflict markers.
In the Current Folder browser, right-click the file, and select Source Control > Extract Conflict Markers to File.
In the Extract Conflict Markers to File dialog box, leave the default option to copy "mine" file version over the conflicted file. Leave the Compare extracted files check box selected. Click Extract.
Use the Comparison Tool report as usual to continue to resolve the conflict.