Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
653 views
in Technique[技术] by (71.8m points)

git - How to resolve merge conflict in pull request in VSTS?

I've created pull request I got into this:

enter image description here

"Approve" button does nothing and complete is disabled.

How do I resolve this confligt in pull request?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Update

Microsoft just added browser based merges. This may get you out of a pickle for small conflicts.

And offers improved visualizations of the different scenarios as of Sprint 150.

For more complex situations:

You have two options to resolve the conflict, reverse-integrate the changes from the target branch (which creates additional merge commits), or rebase on the target branch (which leaves your history nice and clean).


Merge from target to current branch prior to completing the PR.

You need to clone the repo locally, perform a merge from the target branch to your branch and push those changes up to the repository. VSTS will detect the changes and update the pull request.

            -------o3              PR
           /
---------o1-o2                     target

Thus merge target (o2) to PR:

            -------o3-o4           PR
           /          /
---------o1----------o2            target

Then complete the PR

            -------o3-o4           PR
           /          / 
---------o1----------o2--o5        target

Rebase the PR branch to include the latest changes on target

Alternatively, you can clone the repo locally, rebase the PR branch on the latest version of the target branch, solve all issues from the rebase and force-push the changes back to the PR branch. VSTS will detect the changes and update the pull request.

            -------o3              PR
           /
---------o1-o2                     target

Thus rebase o3 onto o2:

              -------o3            PR
             /
---------o1-o2                     target

Then complete the PR (with Fast-forward merge in the case below):

---------o1-o2-o3                  target

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...