简体   繁体   English

从Dev到Master的Azure DevOps Pull Request正在获取旧代码

[英]Azure DevOps Pull Request from Dev to Master is fetching old code

I am having this scenario when merging code using Git in Azure DevOps : Azure DevOps中使用Git合并代码时,遇到这种情况:

On 7/30: A pull request was created to merge code from Dev branch to Master choosing the Squash and Merge option. 在7/30:创建了一个拉取请求,以将代码从Dev分支合并到Master,选择Squash and Merge选项。 So, only one single commit was done without preserving all history. 因此,仅完成了一次提交而不保留所有历史记录。

From 7/31 to 8/6: All feature branches are already merge into the Dev branch with the Merge commit option preserving all commit history. 从7/31到8/6:所有功能分支已经通过合并提交选项合并到Dev分支中 ,保留所有提交历史记录。

Now, on 8/7: I am trying to merge Dev branch to master one more time (doing this at the end of each Sprint). 现在,在8/7上:我试图将Dev分支合并到另一个主机上 (在每个Sprint的末尾执行此操作)。 However, while creating the pull request something I noticed and took my attention is that on the pull request, I am getting older changes before 7/30. 但是,在创建拉取请求时,我注意到并引起注意的是,在拉取请求中,我在7/30之前得到了较旧的更改。

在此处输入图片说明

Should not the pull request be showing/ displaying all changes done from 7/31 to 8/6? 拉取请求不应该显示/显示从7/31到8/6的所有更改吗?

在此处输入图片说明

I think the older commits will be displayed because the last time you merged was squash merge. 我认为将显示较早的提交,因为上次合并是壁球合并。

Squash merging allows you to condense the commits of topic branches and adds them to a single new commit on the default branch. 壁球合并使您可以压缩主题分支的提交,并将它们添加到默认分支的单个新提交中。 Instead of each commit on the topic branch being added to the history of the default branch. 而不是将对主题分支的每次提交添加到默认分支的历史记录中。

This means that the original commits on the dev branch will not be merged to the master branch. 这意味着在dev分支上的原始提交将不会合并到master分支。 Commits in pr shows all newly generated commits after the last merge,but since you choose squash merge, so the previous commits on the dev branch will also show up. pr中的提交会显示最后一次合并后的所有新生成的提交,但是由于您选择了壁球合并,因此也会显示dev分支上的先前提交。

When squash merging, it's a good practice to delete the source branch. 壁球合并时,删除源分支是一个好习惯。 This prevents confusion as the topic branch itself does not have a commit merging it into the default branch . 这可以防止混淆, 因为主题分支本身没有将其合并到默认分支中的提交

The above reference is mentioned in the document . 文档中提到了以上参考。

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

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