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.
Pareto Charts in Power BI and the DAX behind them
The Pareto principle, commonly referred to as the 80/20 rule, is a concept of prioritisation.
Apr
Databricks: Cluster Configuration
Databricks, a cloud-based platform for data engineering, offers several tools that can be used to
Apr
AI Assistance in Microsoft Fabric
The exponential growth of Large Language Models (LLMs) couples with Microsoft’s close partnership with OpenAI
Apr
10 reasons why it’s worth the effort to understand the value of your data
“If leaders really want to create a data driven culture, the journey starts with them!
Apr
Content Safety in Azure AI Studio
Azure AI Content Safety is a solution designed to identify harmful content, whether generated by
Apr
Model Benchmarks in Azure AI Studio
In the constantly changing field of artificial intelligence (AI) and machine learning (ML), choosing the
Apr
Celebrating International Women’s Day: from Classroom to Code
As we celebrate International Women’s Day, I want to share my journey of breaking stereotypes
Mar
Pretty Power BI – Adding Pagination to Bar Charts
Good User Experience (UX) design is crucial in enabling stakeholders to maximise the insights that
Feb