Handling merge conflicts resulting from Theme Upgrade
When you upgrade your theme, UltraCart looks at all the files within your theme that have been modified. If the file has been modified, UltraCart will calculate two sets of change records:
- Previous Version and Your Modified Version
- Previous Version and New Version
As long as none of the changes occur within the same region of the Previous Version then the merge will be clean and no conflicts will occur. However if you modified line 100 of a template and the theme developer also modified line 100 in a different way then a merge conflict will occur.
The active theme cannot be upgraded if any merge conflicts are detected to avoid breaking the live site.
UltraCart does a pre-upgrade check to see if any merge conflicts are going to occur. If so, the system will force you to:
- duplicate your theme
- upgrade the duplicate
- resolve the merge conflicts
- activate the new theme
This will protect your production site during the upgrade process. At the end of an upgrade, if there are merge conflicts the result dialog will tell you the file paths of the templates in conflict.
To find and resolve the merge conflicts first navigate to the File Manager as shown below.
Now click on the Merge Conflicts search icon shown in the toolbar. This will find all the files within your StoreFront that have merge conflicts. You will also notice that the words "merge conflict" appear in brackets to the right of the version number if the file contains any conflicts.
Click on the file name and it will open up the file editor.
When the file editor first appears there will be a warning at that top indicating that the file contains merge conflicts like the example below. You can click on the orange warning and it will dismiss.
The middle section of the merge editor will be the final document. At the top of the middle editor is an indication of the number of merge conflicts in the file. As you scroll down the file you will see the merge conflicts as shown below.
The next step is to decide which code block to merge into the final result. The left side editor is the new theme file with your changes applied (except for the conflict areas) and the right side is your file with changes applied (except for the conflict areas). Click one of the two merge arrows to move the content over.
After the merge conflicts are resolved the counter at the top of the page will show zero and the save button will enable.
Some merge conflicts are complex depending upon the edits you've made to the template. You should always analyze the final merged file to make sure the code is correct.