Contact Us 1-800-596-4880

Solve Conflicts

In certain scenarios, someone else might have modified the version in Design Center while you modified the same version locally. This triggers a conflict in git.

For example, you might have modified a file in a branch, while someone else modified this very same file in the same branch directly in Design Center. By the time you want to push your changes, git rejects the push command because it cannot fast-forward your changes to the version in Design Center, meaning that you must tell git how to apply your changes over a modified version:

  1. In the Package Explorer view, right-click your API specification project and select Team > Switch To > Push Branch…​.

    push branch
  2. Git rejects the push due to the conflicting file:

    conflict
  3. Pull the changes from Design Center into your local version.

    pull changes
  4. Evaluate the conflicts flagged by git:

    flagged commit
1 Your local commit flagged as conflicting.
2 The commit made by another collaborator flagged as conflicting.
  1. Git flags the conflicting parts of the file in the API editor view:

    resolve marked conflict
    <<<<<<< HEAD
              - LAX
              - CLE
    ======= (1)
              - CLE
              - LAX
    >>>>>>> branch 'add-flights-path' of https://anypoint.mulesoft.com/ (2)
    1 Everything between the characters HEAD and ======= are your changes.
    2 Everything between the characters ======= and branch …​ are the changes in Design Center conflicting with yours.

    In this case, another collaborator changed the definition from:

    /flights:
      get:
        queryParameters:
          destination:
            required: false
            enum:
              - SFO
              - LAX
              - CLE

    To:

    /flights:
      get:
        queryParameters:
          destination:
            required: false
            enum:
              - SFO
              - CLE
              - LAX

    The conflict happens because git does not know which change to prioritize.

  2. Remove the change you don’t want to keep:

    push conflict changes
1 Ensure that your changes remain in the file.
2 Add your changes to the index.
  1. Select Commit and Push.

Your copies between Studio and Design Center are synchronized with your latest changes.