Part of the role of source control is to ensure that any simultaneous updates to code and logic done in a collaborative development environment, do not override each other.
And in any case when this happens, a “Conflict” arises when Merging the Branch or raising a Pull Request. This would mean that someone will have to review the code in the source and target branches – potentially side-by-side – and decide which one to keep or how to merge the logic as one.
When using GIT repositories in Azure DevOps, solving Conflicts that arise within the Pull Request screen – might mean that one must go back to Visual Studio (or any IDE they are using). There they then merge the target branch into the local source branch to solve the conflicts there before pushing back the changes within the Pull Request (or raise a separate Pull Request afterwards).
However, one tool which I found helpful to reduce the steps required during such process is an extension named “Pull Request Merge Conflict Extension” by Microsoft DevLabs that can be installed on Azure DevOps.
Extension in Action
Let’s see an example below.
A SQL Post-Deployment exists in the VS Solution, that adds the following list of users to [Table].[UserDetails]. This Post-Deployment script is already part of the develop branch.
SET IDENTITY_INSERT [Table].[UserDetails] ON; INSERT INTO [Table].[UserDetails] ([UserKey],[Name],[Surname]) VALUES ( 1, N'Alex', N'Smith'), ( 2, N'Dan', N'Brown'), ( 3, N'Mark', N'Black'), ( 4, N'Mike', N'Lee') SET IDENTITY_INSERT [Table].[UserDetails] OFF; GO
Two different members of the development team, each create a feature branch off the develop branch (“Branch#1” and “Branch#2”) and amend the same script within the different branches – by each adding a new line in the same line number on the separate branches.
In “Branch#1”, the first developer added the new row for “Pete Law”:
A PR for “Branch#1” has been raised, got approved and been merged to the develop branch.
In the meantime, the second developer, added a new user/line of code within the same line number.
As a PR is raised on “Branch#2”, to merge the work to develop branch (after the first developer has already done so), a conflict will arise as per below:
With the extension in DevOps, instead of solving the issue on the local “Branch#2” and push back again, one could go in through “Conflicts” tab and amend the changes straight in DevOps.
Once in “Conflicts” a merge script window at the bottom would be generated. In this case, this couldn’t be left as is, since we will end up with duplicate rows for UserKey 4, and also with two users having the same UserKey 5 – which will violate the IDENTITY_INSERT setting:
The bottom window tab can then be modified directly, the unneeded rows removed and one of the new Lines having the UserKey changed to 6:
This can then be merged as follows, which will put the script in a state that can be approved and PR-ed:
For each resolution done via the Conflicts tab, a comment is then generated within the main “Overview” tab of that branch – which will indicate that a conflict had occurred and has been resolved:
Implementing Extension
To implement this extension in DevOps, one can go to the Marketplace icon, do “Browse marketplace” and look for it by the search:
Alternatively click directly on this URL: https://marketplace.visualstudio.com/items?itemName=ms-devlabs.conflicts-tab
After choosing the Azure DevOps Organisation name from the dropdown, one can download and install.
When all is complete, the following screen will show:
To be able to install the extension yourself, one needs to be a member of the “Project Collection Administrators” or set as an organization Owner on DevOps. However, if one is not, one can always request the extension.
For more information about the services and industries Adatis can help with, please visit our main website here.
Introduction to Data Wrangler in Microsoft Fabric
What is Data Wrangler? A key selling point of Microsoft Fabric is the Data Science
Jul
Autogen Power BI Model in Tabular Editor
In the realm of business intelligence, Power BI has emerged as a powerful tool for
Jul
Microsoft Healthcare Accelerator for Fabric
Microsoft released the Healthcare Data Solutions in Microsoft Fabric in Q1 2024. It was introduced
Jul
Unlock the Power of Colour: Make Your Power BI Reports Pop
Colour is a powerful visual tool that can enhance the appeal and readability of your
Jul
Python vs. PySpark: Navigating Data Analytics in Databricks – Part 2
Part 2: Exploring Advanced Functionalities in Databricks Welcome back to our Databricks journey! In this
May
GPT-4 with Vision vs Custom Vision in Anomaly Detection
Businesses today are generating data at an unprecedented rate. Automated processing of data is essential
May
Exploring DALL·E Capabilities
What is DALL·E? DALL·E is text-to-image generation system developed by OpenAI using deep learning methodologies.
May
Using Copilot Studio to Develop a HR Policy Bot
The next addition to Microsoft’s generative AI and large language model tools is Microsoft Copilot
Apr