Contact Us 1-800-596-4880

Solve Conflicts

In certain scenarios, someone else can introduce changes in the version in MuleSoft VCS at the same time you modify 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 MuleSoft VCS. 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 MuleSoft VCS, 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…​.

    A dropdown menu displaying choices for a software development project, featuring Git commands such as pull and push
  2. Git rejects the push due to the conflicting file:

    A window appears with the push results, including the repository URL and message details
  3. Pull the changes from MuleSoft VCS into your local version.

    A menu displaying choices for a Git repository
  4. Evaluate the conflicts flagged by Git:

    A window displaying the outcomes of a fetch and update of flights-api data, with a conflicting result and two merge input choices
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:

    Code displaying a RAML API for American Flights
    <<<<<<< 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 MuleSoft VCS 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:

    A code editor displaying a commit message and a conflict list
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 MuleSoft VCS are synchronized with your latest changes.