git 如何解决 VSTS 中拉取请求中的合并冲突?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46692989/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to resolve merge conflict in pull request in VSTS?
提问by Liero
采纳答案by jessehouwing
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.
并提供了从 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.
在完成 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.
您需要在本地克隆 repo,执行从目标分支到您的分支的合并并将这些更改推送到存储库。VSTS 将检测更改并更新拉取请求。
-------o3 PR
/
---------o1-o2 target
Thus merge target (o2)
to PR
:
因此合并target (o2)
为PR
:
-------o3-o4 PR
/ /
---------o1----------o2 target
Then complete the PR
然后完成PR
-------o3-o4 PR
/ / \
---------o1----------o2--o5 target
Rebase the PR branch to include the latest changes on target
重新设置 PR 分支以包含目标上的最新更改
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.
或者,您可以在本地克隆 repo,将 PR 分支重新设置为目标分支的最新版本,解决所有问题并强制将更改推送回 PR 分支。VSTS 将检测更改并更新拉取请求。
-------o3 PR
/
---------o1-o2 target
Thus rebase o3
onto o2
:
因此变基o3
到o2
:
-------o3 PR
/
---------o1-o2 target
Then complete the PR
(with Fast-forward merge in the case below):
然后完成PR
(在下面的情况下使用快进合并):
---------o1-o2-o3 target
回答by sky91
- Open your project with Visual Studio.
- Open View> Team Explorer
- Change to Branchestab.
- Double click to the branch you intend to merge (e.g. dev).
- Right Click > Merge From > Select
Merge from branch: master,
Into current branch: dev - Click Mergebutton
- Choose the conflict file(s)
- Then resolve the conflicts. You can click the left or right checkbox for the section you want to include.
- Then commit the merge
- Done.
- 使用 Visual Studio 打开您的项目。
- 打开视图>团队资源管理器
- 更改为分支选项卡。
- 双击要合并的分支(例如 dev)。
- 右键单击 > 合并自 > 选择
合并自分支:master,
进入当前分支:dev - 单击合并按钮
- 选择冲突文件
- 然后解决冲突。您可以单击要包含的部分的左侧或右侧复选框。
- 然后提交合并
- 完毕。
回答by BipinR
You could do the above technique by @jessiehouwing or use the new plug-in. MicrosoftDevLabs released the link to the plugin to resolve conflicts. The link to plugin is given below https://marketplace.visualstudio.com/items?itemName=ms-devlabs.conflicts-tab
您可以通过@jessiehouwing 执行上述技术或使用新插件。MicrosoftDevLabs 发布了该插件的链接以解决冲突。插件链接如下 https://marketplace.visualstudio.com/items?itemName=ms-devlabs.conflicts-tab