如何在 Visual Studio/VSTS/Git 中手动解决 sqlproj 文件中的合并冲突?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47385645/
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 manually resolve a merge conflict in a sqlproj file in Visual Studio/VSTS/Git?
提问by Tony_Henrich
I am not very familiar with Git in Visual Studio 2017. I created a new branch from a branch. Made some changes. Pushed the new changes to our repo at visualstudio.com. Created a new pull request and now I am getting the error below. I am not sure what the next step is. If I click on Abandon, I get two options. Reactive or delete source branch. How do I manually resolve this issue? I am trying to find a way to show the conflict inside Visual Studio so I can use the merge tool and edit the conflict. I have no changes showing in VS after I have pushed them to the remote repo. Can't find a way to find out what the cause of the conflict is and how to manually resolve it.
我对 Visual Studio 2017 中的 Git 不是很熟悉,我从一个分支创建了一个新分支。做了一些改变。将新更改推送到我们位于 visualstudio.com 的存储库中。创建了一个新的拉取请求,现在我收到以下错误。我不确定下一步是什么。如果我点击放弃,我会得到两个选项。反应式或删除源分支。如何手动解决此问题?我试图找到一种方法来显示 Visual Studio 内部的冲突,以便我可以使用合并工具并编辑冲突。将它们推送到远程存储库后,VS 中没有显示任何更改。找不到办法找出冲突的原因以及如何手动解决它。
This linkshows how to resolve Git conflicts but I have nothing in VS showing any conflicts. The conflict warning is showing on the VSTS website. What's the next step?
此链接显示了如何解决 Git 冲突,但我在 VS 中没有任何显示任何冲突的内容。冲突警告显示在 VSTS 网站上。下一步是什么?
回答by starian chen-MSFT
Refer to these steps to resolve conflicts:
请参阅以下步骤来解决冲突:
- Open Branches in Team Explorer
- Double click the target branch to switch branch (e.g. master)
- Right click the target branch=> Pull
- Double click the source branch to switch branch (e.g. dev)
- Click Merge
- Choose master in Merge from branch and choose dev in Into current branch
- Click Merge
- Click Conflicts link=>Select the file=>Click Merge
- Resolve conflicts
- Click Commit Merge in Team Explorer
- Commit and push dev changes to remote branch
- Complete the pull request
- 在团队资源管理器中打开分支
- 双击目标分支切换分支(如master)
- 右键单击目标分支=> 拉取
- 双击源分支切换分支(例如dev)
- 单击合并
- 在 Merge from branch 中选择 master 并在 Into current branch 中选择 dev
- 单击合并
- 点击冲突链接=>选择文件=>点击合并
- 解决冲突
- 在团队资源管理器中单击提交合并
- 提交并将开发更改推送到远程分支
- 完成拉取请求
回答by VonC
In order to see a difference between two branches locally (and being able to resolve a conflict locally), try and fetch first: that will fetch all branches, and update their history.
为了在本地查看两个分支之间的差异(并能够在本地解决冲突),请先尝试获取:这将获取所有分支,并更新它们的历史记录。
See "Update code with fetch and pull".
请参阅“使用 fetch 和 pull 更新代码”。
Then you can try a local merge to see and resolve the conflicts: see "Resolve merge conflicts". If you can, rebase your branch on top of the updated target branch locally, then force push (if you are the only one working on said branch): that will update the pull request.
If not, merge the target branch to your branch and resolve the conflicts locally. Then a simple push of the merge commit will be enough.
然后您可以尝试本地合并以查看和解决冲突:请参阅“解决合并冲突”。如果可以,请在本地更新的目标分支之上重新设置您的分支,然后强制推送(如果您是唯一一个在该分支上工作的人):这将更新拉取请求。
如果没有,请将目标分支合并到您的分支并在本地解决冲突。然后简单地推送合并提交就足够了。