Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

Image Removed

The next step is to look through the file and identify the block of merge conflict HTML that needs to be fixed.  In this example we have the following block of code.

Code Block
languagexml
themeDJango
titleExample Merge Conflict
<<<<<<< /templates/template_item.vm[new theme]
        #if($item.isReviewable())
          <dd>
            <a href="#panel-product-reviews" id="product-reviews-tab" title="View this">
              <span class="show-for-medium-up">Product </span> Reviews
            </a>
          </dd>
        #end
||||||| /templates/template_item.vm[previous theme]
        <dd>
          <a href="#panel-product-reviews" id="product-reviews-tab" title="View this">
            <span class="show-for-medium-up">Product </span> Reviews
          </a>
        </dd>
=======
        <dd>
          <a href="#panel-product-reviews" id="product-reviews-tab" title="View this">
            <span class="show-for-medium-up">Product </span> Reviews
          </a>
        </dd>
        <dd>
          <a href="#panel-product-component" id="component-id-guide-tab" title="View this">
            <span class="show-for-medium-up"></span> Component ID Guide
          </a>
        </dd>
      <dd>
          <a href="#instructions" id="instructions-tab" title="View this">
            <span class="show-for-medium-up"></span> Instructions
          </a>
        </dd>
>>>>>>> /templates/template_item.vm[modified]

A merge conflict block is broken down into three parts that appear in the following order:

  1. Content from the new version of the file (located between <<<<<<< and |||||||||)
  2. Content from the previous version of the file (located between ||||||||||| and =========)
  3. Modified content created by the merchant (located between ========== and >>>>>>>)

First you want to compare segments one and two to understand the intent of the change that the theme developer made.  In this example we can see that the theme developer was surrounding the dd tags with a new if statement.  Next we need to determine what the change we made was.  In this example we added a new dd tag for the Component ID Guide and a new dd tag for Instructions.  Now that we understand what both developers were trying to do we can come up with the resolution to the merge conflict.  In this case we want the final code to look line:

Code Block
languagexml
themeDJango
titleMerge Conflict Resolution
        #if($item.isReviewable())
        <dd>
          <a href="#panel-product-reviews" id="product-reviews-tab" title="View this">
            <span class="show-for-medium-up">Product </span> Reviews
          </a>
        </dd>
        #end
        <dd>
          <a href="#panel-product-component" id="component-id-guide-tab" title="View this">
            <span class="show-for-medium-up"></span> Component ID Guide
          </a>
        </dd>
        <dd>
          <a href="#instructions" id="instructions-tab" title="View this">
            <span class="show-for-medium-up"></span> Instructions
          </a>
        </dd>

So we would want to edit the file so that we remove everything between:

Code Block
languagexml
themeDJango
titleMerge Conflict Begin/End
<<<<<<< /templates/template_item.vm[new theme]
>>>>>>> /templates/template_item.vm[modified]

and replace that section with our merge conflict resolution.  Upon saving the file UltraCart will notice that the merge conflict has been resolved.

 

 

 

 Image Added

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.

Image Added

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.

Image Added

After the merge conflicts are resolved the the counter at the top of the page will show zero and the save button will enable.

Image Added

 

Note

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.