跳到主要内容

Resolving Conflicts

A Pull Request conflict occurs when the system cannot automatically determine how to merge code changes during the merging of branches. This typically happens in the following situations:

  • Two branches simultaneously modify the same part of the same file.
  • The target branch of the Pull Request already includes changes that are not present in the source branch.

Resolving conflicts allows the team to collaboratively resolve issues, ensuring that the Pull Request successfully merges into the target branch.

Basic Steps for Resolving Conflicts


When a Pull Request has conflicts, you can follow these basic steps to resolve it:

  1. Open the Pull Request:
  • On the project page, click on "Pull Requests" and then select the Pull Request with the conflict.

image-20250102141704983

  1. View the Conflict:
  • Under the "Discussions" tab on the PR details page, there will be a prompt indicating the existence of a conflict. Click "Resolve conflict online" to view the conflict.

image-20250102142341270

  1. Resolve the Conflict:
  • After reviewing the code, choose either "Use source branch" or "Use target branch" as needed to resolve the conflict.

image-20250102142621395

  1. Submit Changes:

After resolving the conflict, click "Commit resolved conflict".

image-20250102142710269

  1. Complete the Merge:

After resolving the conflict, proceed with the merge as usual. Click "Merge" to integrate the resolved code into the target branch.

image-20250102142938054

Manual Conflict Resolution


If you need more fine-grained control or a custom solution, you can manually resolve the conflict:

  1. Switch to "Edit mode" at the top right of the conflict resolution page to manually edit the file, deleting or modifying the conflicting parts.

image-20250102144041844

  1. Remove the conflict markers (<<<<<<<, =======, >>>>>>>).

image-20250102143747210

  1. Submit the changes.