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:
-
In the Package Explorer view, right-click your API specification project and select Team > Switch To > Push Branch….
-
Git rejects the push due to the conflicting file:
-
Pull the changes from MuleSoft VCS into your local version.
-
Evaluate the conflicts flagged by Git:
1 | Your local commit flagged as conflicting. |
2 | The commit made by another collaborator flagged as conflicting. |
-
Git flags the conflicting parts of the file in the API editor view:
<<<<<<< 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 =======
andbranch …
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.
-
Remove the change you don’t want to keep:
1 | Ensure that your changes remain in the file. |
2 | Add your changes to the index. |
-
Select Commit and Push.
Your copies between Studio and MuleSoft VCS are synchronized with your latest changes.