Resolving Pull Request Conflicts
Written for the Old UI
This article was written for the old UI. The instructions are still usable, but the screenshots are outdated. In some cases, items referenced in the instructions have moved or changed. If you cannot find an item, see the Where Did It Go article.
Overview
This article explains the reasons behind Pull Request conflicts and the common scenarios in which they occur. It also provides detailed, step-by-step instructions for reviewing and resolving these conflicts effectively.
What causes a Pull Request conflict?
A Pull Request conflict can occur when two branches have commits that affect the same line of code, and the Pull Request is unable to automatically determine which line to preserve. To illustrate how this can happen, see the diagram below.

In this example, branch_b is created from branch_a. Next, a change affecting the myName function is committed to branch_b, and a different change to the function is committed to branch_a. When a Pull Request is created to merge branch_b into branch_a, the pull request detects that the same line of code has changed in both branches, resulting in a conflict. In the following section, you will see two different options for resolving the conflict.
How to resolve a Pull Request conflict?
When a Pull Request encounters a conflict, you can resolve it by either retaining or overwriting the target's changes. For multiple conflicts, address each one separately using the most appropriate method; it's okay to use different approaches for different conflicts.
Resolving Conflicts
Review Conflicts
Click Resolve conflicts.

Click a component to view the conflicts.

All components need to be reviewed and resolved.
Review the conflicting code in the component and determine how to resolve the conflict.

There are two ways to resolve a Pull Request conflict. See the following sections for instructions about how to perform each.
Retain Target Changes: This method keeps the target's code by committing the conflicting lines from the target branch into the source branch.
Overwrite Target Changes: This method keeps the source's code by committing the conflicting lines from the source branch to the target branch.
Retain Target Changes
This method uses the Resolve conflicts feature built into a Pull Request.
Click a component with conflicts to resolve.

Click Accept all to retain all lines, or click the Right Arrow for each line to retain. This copies the selected line from the target branch to the source branch.

Once all necessary changes have been made to the source branch, click Resolve. This marks a component as Resolved so you can keep track of your changes.
Click Back.

Once all components are marked as Resolved, click Resolve conflicts.

Enter a Commit message.
Click Resolve.

After resolving the conflicts, the Pull Request will check for conflicts again.
If there are no more conflicts, the Pull Request message will be green and state "This branch is able to merge".

Overwrite Target Changes
This method requires manually editing and committing changes to the target branch.
Click Code from the left sidebar menu.
Click the target branch of the Pull Request.

Click the Three Vertical dots at the right end of a component with conflicts in the Pull Request.
Click Edit.

Edit the conflicting line or lines of code to match the source branch.
Click Commit changes.

Enter a Commit message.
Click Commit.

Once all components with conflicts are edited to match the source branch, return to the Pull Request.
Click Pull requests from the left sidebar menu.
Click the Pull Request to check if all conflicts are resolved.

If there are no more conflicts, the Pull Request message will be green and state "This branch is able to merge".

Last updated
Was this helpful?


