IP Library Granted Patent US 12688033
Granted Patent B2
US 12688033 · App. 18/421,557 · Granted Jul 21, 2026

Automatically resolving merge conflicts in a computer system

Inventors: Amritam Sarcar (Sammamish, WA); Andrew Stephen Zeigler (Redmond, WA); Hitesh Kanwathirtha (Woodinville, WA); Zachary Michael Murphy (Seattle, WA); Javier Nisim Flores Assad (Bothell, WA); Jeffrey Tzu Heng Lin (Redmond, WA)
Assignee: Microsoft Technology Licensing, LLC
G06F8/71G06F8/30G06F8/34G06F8/35G06F8/41G06F8/42G06F8/44G06F8/65G06F8/658G06F8/70G06F8/73G06F9/44505G06F9/455G06F9/545G06F11/079G06F11/1471G06F11/3495G06F11/3608G06F11/3616
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12688033
App. No.
18/421,557
Granted
Jul 21, 2026
Kind
B2
Abstract

Merge conflicts are identified when changes from two different developers are merged into a code base in a code repository. When the changes from the two different developers conflict with one another, a merge conflict is identified. A pattern resolution system identifies whether the merge conflict contains any of a plurality of different conflict patterns. If so, a pattern conflict resolver, corresponding to the identified conflict pattern, is applied to the merge conflict to automatically resolve the merge conflict. If none of the pattern resolvers are applied to the merge conflict, the merge conflict is provided to a large language model for resolution. The Large Language Model (LLM) generates a proposed conflict resolution. A normalized divergence distance metric is calculated for the proposed conflict resolution and compared to a set of threshold values. The proposed conflict resolution is determined to be valid based upon the comparison.

Claims (61)

1 . A computer implemented method, comprising:

detecting a merge conflict between a first set of modified code generated based on first changes to a set of code in a shared code base and a second set of modified code generated based on second changes to the set of code in the shared code base;

detecting whether the merge conflict includes a pre-defined conflict pattern;

when the merge conflict includes a pre-defined conflict pattern, then:

invoking a pattern resolver corresponding to the pre-defined conflict pattern to automatically generate a conflict resolution to resolve the merge conflict, wherein invoking the pattern resolver comprises:

detecting whether a first pattern resolver, of a set of pattern resolvers, can generate a conflict resolution to resolve the merge conflict based on the detected pre-defined conflict pattern;

when the first pattern resolver is determined to be able to generate the conflict resolution, invoking the first pattern resolver to generate the conflict resolution;

when the first pattern resolver is determined to be unable to generate the conflict resolution, detecting, in a pre-defined order, whether a second pattern resolver in the set of pattern resolvers, can generate a conflict resolution to resolve the merge conflict, based on the detected pre-defined conflict pattern; and

when the second pattern resolver is determined to be able to generate the conflict resolution, invoking the second pattern resolver to generate the conflict resolution; and

when the merge conflict does not include a pre-defined conflict pattern, then:

prompting a generative artificial intelligence (Al) system for a proposed conflict resolution;

generating a normalized divergence distance (NDD) value for the proposed conflict resolution indicative of a distance that the proposed conflict resolution diverges from the set of code in the shared code base; and

generating a conflict resolution output based on the NDD value.

2 . The computer implemented method of claim 1 , further comprising:

generating an NDD value for the first set of modified code indicative of a distance that the first set of modified code diverges from the set of code in the shared code base.

3 . The computer implemented method of claim 2 , further comprising:

generating an NDD value for the second set of modified code indicative of a distance that the second set of modified code diverges from the set of code in the shared code base.

4 . The computer implemented method of claim 3 , wherein generating the conflict resolution output based on the NDD value, comprises:

comparing the NDD value for the proposed conflict resolution to the NDD value for the first set of modified code to obtain a first comparison result.

5 . The computer implemented method of claim 4 , wherein generating the conflict resolution output based on the NDD value, comprises:

comparing the NDD value for the proposed conflict resolution to the NDD value for the second set of modified code to obtain a second comparison result.

6 . The computer implemented method of claim 5 , wherein generating the conflict resolution output comprises:

generating the conflict resolution output based on the first comparison result and the second comparison result.

7 . The computer implemented method of claim 6 , wherein generating the conflict resolution output based on the first comparison result and the second comparison result comprises:

generating, as the conflict resolution output, the proposed conflict resolution when the first comparison result and the second comparison result indicate that the NDD value for the proposed conflict resolution is between the NDD value for the first set of modified code and the NDD value for the second set of modified code.

8 . The computer implemented method of claim 7 , wherein generating the conflict resolution output based on the first comparison result and the second comparison result comprises:

generating, as the conflict resolution output, an indication that the merge conflict is to be resolved by an alternative technique when the first comparison result and the second comparison result indicate that the NDD value for the proposed conflict resolution is outside of a range defined by the NDD value for the first set of modified code and the NDD value for the second set of modified code.

9 . A computer system, comprising:

at least one processor;

a plurality of pattern resolvers, implemented by the at least one processor, each different pattern resolver being configured to generate a conflict resolution for a merge conflict having a different conflict pattern;

a merge conflict identifier detecting a merge conflict between a first set of modified code generated based on first changes to a set of code in a shared code base and a second set of modified code generated based on second changes to the set of code in the shared code base;

a conflict pattern detector, implemented by the at least one processor, configured to detect a conflict pattern in the merge conflict;

a pattern resolver selection system, implemented by the at least one processor, selecting, in a pre-defined selection order, a pattern resolver of the plurality of pattern resolvers, determining whether the selected pattern resolver can generate a conflict resolution to resolve the merge conflict based on the detected conflict pattern and, when the selected pattern resolver can generate the conflict resolution, invoking the selected pattern resolver to generate the conflict resolution and, when the selected pattern resolver cannot generate the conflict resolution, selecting another pattern resolver, of the plurality of pattern resolvers, in the pre-defined selection order; and

a resolution output system generating an output indicative of the generated conflict resolution or, when none of the pattern resolvers in the plurality of pattern resolvers were invoked to generate a conflict resolution to resolve the merge conflict, an indication that none of the pattern resolvers were invoked.

10 . The computer system of claim 9 , further comprising:

a model interaction system configured to, based on the output from the resolution output system indicating that none of the pattern resolvers were invoked, request a model to generate a proposed conflict resolution.

11 . The computer system of claim 10 , wherein the model interaction system comprises:

a normalized divergence distance (NDD) computation system configured to compute a proposed resolution NDD value for the proposed conflict resolution indicative of a distance that the proposed conflict resolution diverges from the set of code in the shared code base; and

an output generator configured to generate a conflict resolution output based on the proposed resolution NDD value.

12 . The computer system of claim 11 , wherein the NDD computation system is configured to compute a first NDD value for the first set of modified code indicative of a distance that the first set of modified code diverges from the set of code in the shared code base and generate a second NDD value for the second set of modified code indicative of a distance that the second set of modified code diverges from the set of code in the shared code base, the output generator generating the conflict resolution output based on the first NDD value, the second NDD value, and the proposed resolution NDD value.

13 . The computer system of claim 12 , wherein the model interaction system comprises:

a boundary comparison system configured to compare the proposed resolution NDD value to the first NDD value to obtain a first comparison result and to compare the proposed resolution NDD value to the second NDD value to obtain a second comparison result.

14 . The computer system of claim 13 , wherein the output generator is configured to generate the conflict resolution output based on the first comparison result and the second comparison result.

15 . The computer system of claim 14 , wherein the output generator is configured to, generate, as the conflict resolution output, the proposed conflict resolution when the first comparison result and the second comparison result indicate that the proposed resolution NDD value is between the first NDD value and the second NDD value.

16 . The computer system of claim 15 , wherein the output generator is configured to, generate, as the conflict resolution output, an indication that the merge conflict is to be resolved by an alternative technique when the first comparison result and the second comparison result indicate that the proposed resolution NDD value is outside of a range defined by the first NDD value and the second NDD value.

17 . A computer implemented method, comprising:

detecting a merge conflict between a first set of modified code generated based on first changes to a set of code in a shared code base and a second set of modified code generated based on second changes to the set of code in the shared code base;

detecting a conflict pattern in the merge conflict;

selecting, in a pre-defined selection order, a pattern resolver of a plurality of pattern resolvers, each different pattern resolver being configured to generate a conflict resolution for a merge conflict having a different conflict pattern;

determining whether the selected pattern resolver can generate a conflict resolution to resolve the merge conflict based on the detected conflict pattern;

after it is determined that the selected pattern resolver can generate a conflict resolution resolving the merge conflict, invoking the selected pattern resolver to generate the conflict resolution;

after it is determined that the selected pattern resolver cannot generate a conflict resolution resolving the merge conflict, selecting another pattern resolver, of the plurality of pattern resolvers, in the pre-defined selection order;

when a pattern resolver, of the plurality of pattern resolvers, is invoked, generating an output indicative of the generated conflict resolution; and

when none of the pattern resolvers in the plurality of pattern resolvers is invoked to generate a conflict resolution to resolve the merge conflict, generating an output indicating that none of the pattern resolvers were invoked.

18 . The computer implemented method of claim 17 , further comprising:

based on the output indicating that none of the pattern resolvers were invoked:

prompting a generative artificial intelligence (Al) system for a proposed conflict resolution;

generating a normalized divergence distance (NDD) value for the proposed conflict resolution indicative of a distance that the proposed conflict resolution diverges from the set of code in the shared code base; and

generating a conflict resolution output based on the NDD value.

19 . The computer implemented method of claim 18 , wherein the NDD value is measured in terms of a number of edits performed to modify the set of code in the shared code base to code associated with the proposed conflict resolution.

20 . The computer implemented method of claim 17 , wherein the pre-defined selection order is based on a frequency of occurrence of one or more predefined patterns.