[英]Azure DevOps Pull Request after Cherry Picking
I'm working with Azure DevOps and running into a situation with git and a Pull Request I can't understand and looking for help.我正在使用 Azure DevOps,遇到了 git 和 Pull Request 的情况,我无法理解并寻求帮助。
Here is the scenario:这是场景:
I cherry pick commit 123 from dev with a target branch of stage into a topic branch.我从 dev 中挑选 commit 123,将 stage 的目标分支转换为主题分支。 The topic branch is then pull requested into stage.
然后将主题分支请求拉入阶段。
I then repeat this process for commit 124 and 125 from dev.然后我对来自 dev 的提交 124 和 125 重复此过程。
If I compare file.txt in the dev branch to file.txt in the stage branch they are now identical content wise.如果我将 dev 分支中的 file.txt 与 stage 分支中的 file.txt 进行比较,它们现在是相同的内容。
If I submit a pull request in Azure DevOps from dev to stage on the Files tab of the pull request it is showing me the proposed changes to file.txt as if the dev commits had never been cherry picked into the stage version of file.txt.如果我在拉取请求的“文件”选项卡上从开发人员到阶段提交 Azure DevOps 中的拉取请求,它会向我显示对 file.txt 的建议更改,就好像开发提交从未被选入 file.txt 的阶段版本一样.
I realize that when I cherry pick, a new commit is created within stage so the stage branch does not realize commits 123,124,125 from dev have been applied -- but shouldn't the Azure DevOps File view know the content of file.txt is the same?我意识到当我选择时,会在 stage 内创建一个新的提交,因此 stage 分支没有意识到来自 dev 的提交 123,124,125 已被应用——但 Azure DevOps File 视图不应该知道 file.txt 的内容是相同的?
That happens because the diff that you see there is not between the source branch and the target branch.发生这种情况是因为您看到的差异不在源分支和目标分支之间。 The diff is between the source branch and the point where the source branch and the target branch diverged ..... so, you might have modified the file in the target branch in subsequent revisions after the branches diverged.
差异在源分支与源分支和目标分支分歧的点之间......因此,您可能在分支分歧后的后续修订中修改了目标分支中的文件。 It doesn't matter, the diff in the PR in azure devops (well, at least that's the sane way it works in github and gitlab) doesn't care about them.
没关系,azure devops 中 PR 中的差异(好吧,至少这是它在 github 和 gitlab 中的正常工作方式)并不关心它们。
Tip: think of it as a diff not done git diff target source
but rather git diff target...source
(with 3 dots)... and it is done like that because if you did it with a default diff, the diff of the work in a PR would be a moving target.提示:把它想象成一个 diff 没有完成
git diff target source
而是git diff target...source
(with 3 dots)... 这样做是因为如果你用默认的 diff 做它,diff PR 中的工作将是一个移动的目标。 It would always change as new revisions are introduced into the target branch... and you would see things that are not related to the work that was carried out in the source branch (which would make code review HELL) and it is definitely not what git will try to get into the target branch if you try to merge (the merge process involves comparing how the 2 branches have changed since they diverged so no point in checking the diff between the two tips of the branches).它会随时更改为新的修订版引入目标分支...你会看到不相关到在源科(这将使代码审查HELL)开展的工作的事情,这绝不是什么如果您尝试合并,git 将尝试进入目标分支(合并过程涉及比较两个分支自发散以来的变化情况,因此检查分支的两个尖端之间的差异没有意义)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.