简体   繁体   English

如何处理多个PULL请求?

[英]How to handle multiple PULL REQUESTS?

Should I decline all PULL REQUESTS after the first one is accepted, so that hey can merge the accepted PULL REQUEST with their changes to be up to date ? 我应该在第一个请求被接受之后拒绝所有的PULL REQUESTS,以便嘿可以将接受的PULL REQUEST与他们的更改合并为最新的吗?

I have a problem around merging multiple pull requests. 我在合并多个拉取请求时遇到问题。 I'm working in VSTS. 我正在VSTS工作。

Say I have a MASTER branch and I create two PBI's for two bits of work to be done. 假设我有一个MASTER分支,并且为完成两项工作创建了两个PBI。

For these PBI's I create a separate branch for each. 对于这些PBI,我为每个PBI创建一个单独的分支。

When the work is done on these PBI's, each person creates a PULL REQUEST to review before merging back to MASTER. 在这些PBI上完成工作后,每个人都会创建一个PULL REQUEST进行审核,然后再合并回MASTER。

At the time of the PULL REQUEST, both branches are effectively up to date with the MASTER as they have merged the MASTER onto they're PBI branch. 在PULL REQUEST时,两个分支实际上都与MASTER保持同步,因为它们已经将MASTER合并到了它们的PBI分支中。

Now when I accept one of the PULL REQUESTS and merge it down to the MASTER, the other PBI is now behind the MASTER branch. 现在,当我接受一个PULL REQUESTS并将其合并到MASTER时,另一个PBI现在位于MASTER分支的后面。

Is it just a case of rejecting later PBI's and asking them to be made up to date ? 这只是拒绝以后的PBI并要求它们更新的一种情况? And when they are made up to date, I accept them on a first come basis (as long as they're correct). 并且当它们是最新的时,我会以先到先得的方式接受它们(只要它们是正确的)。

The problem I see with this is, if there are 'n' pull requests, I'm going to always have to reject 'n-1' pull requests as when I accept the first one, it leaves the rest out of date. 我看到的问题是,如果存在“ n”个拉取请求,我将总是不得不拒绝“ n-1”个拉取请求,因为当我接受第一个请求时,其余的将过时。

拉取请求问题

The image above shows the MASTER branch (green), and the two feature branches (orange and blue). 上图显示了MASTER分支(绿色)和两个功能分支(橙色和蓝色)。 Both havev made a PULL REQUEST, and when one is accepted, it leaves the other out of date. 双方都提出了PULL REQUEST,当一个被接受时,另一个就过时了。

First pull request approved, gets merged to the master branch first. 第一个拉取请求获得批准,首先合并到master分支。 Subsequent pull requests, don't need to merge master branch on their branch, unless there is merge conflict. 随后的拉取请求,除非存在合并冲突,否则不需要在其分支上合并主分支。 So, they will not be out of date, unless they also worked on the same set of files. 因此,除非它们还处理同一组文件,否则它们不会过时。

When you see merge conflict on a pull request, straight away ask the developer to fix the merge conflict and update the pull request and work on reviewing pull request later. 当您在合并请求中看到合并冲突时,请立即要求开发人员修复合并冲突并更新合并请求,并在以后审查合并请求。 In this case, the subsequent pull request developer is out of date and he has to fix them in the merge conflict fixing. 在这种情况下,后续的拉取请求开发人员已过时,他必须在合并冲突修复中对其进行修复。

So, whichever pull request goes subsequent to prior pull requests, have to take care of merge conflicts related issues. 因此,无论在先前的拉取请求之后是哪个拉取请求,都必须注意与合并冲突相关的问题。

Also if you use the Build validation policy in your branch policies you can set build result for the PR to expire immediatly if master is changed: 同样,如果您在分支策略中使用“ Build validation策略,则可以将PR的构建结果设置为在更改主节点后立即过期: 在此处输入图片说明 This means that the build will be run again meaning you do not only catch merge conflicts but also errors that may be introduced by merging the PR with the updated master. 这意味着该构建将再次运行,这意味着您不仅会捕获合并冲突,而且还会捕获PR与更新后的母版合并可能导致的错误。 Only if you have propper unit tests and have those enabled in your PR validation though. 仅当您具有适当的单元测试并且已在PR验证中启用了这些单元测试时。

You shouldn't need to worry about rejecting one or the other pull request. 您不必担心拒绝一个或另一个拉取请求。

After one pull request has been accepted, VSTS will show a big red error on the second pull request if it contains anything that conflicts with the items pulled in from the first one. 接受一个请求后,如果VSTS包含与从第一个请求中提取的项目冲突的任何内容,则VSTS将在第二个请求中显示一个红色大错误。 This will prevent the pull request from being completed until the conflict is resolved. 在冲突解决之前,这将阻止请求请求完成。

I'm pretty sure you can even configure VSTS to email the person that created the PR if a merge conflict occurs so they can update the PR. 我敢肯定,如果发生合并冲突,您甚至可以将VSTS配置为通过电子邮件发送给创建PR的人,以便他们可以更新PR。

With a well structure application merge conflicts are not very common so this can be a good indicator of the quality of your application architecture. 在结构良好的应用程序中,合并冲突不是很常见,因此这可以很好地指示应用程序体系结构的质量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM