Git branch merge request conflict handling rules

1. Git branch merge request conflict handling rules

1.1. Problem description

When submitting a branch merge request, a conflict occurs and the prompt is 此合并请求有变更与目标分支冲突.

An example is shown in the figure:

insert image description here

1.2. Reasons

The merged target branch has already changed, such as code merged from other branches.

For example, there are two feature branches developed in parallel, the first feature branch has been merged into the develop branch, and the second feature branch is merged at this time, a conflict will arise.

1.3. Solutions (processing rules)

Merge the target branch into the current branch, and submit a branch merge request after resolving conflicts.

For example: merge the develop branch into the feature branch, and then submit a branch merge request.

1.4. VSCode operation example

1.4.1. Step 1: The current feature branch merges the code from the develop branch

insert image description here

Example of conflicting files after merging

insert image description here

1.4.2. Step 2: resolve conflicts, commit, push to remote repository, create merge request

Guess you like

Origin blog.csdn.net/sgx1825192/article/details/129990394