[英]In git, how do I verify that bug fixes are in both the Release branch and in master
We have created a release branch for our latest release.我们为我们的最新版本创建了一个发布分支。 In the meantime, we have continued to work on new features on master.与此同时,我们继续在 master 上开发新功能。
We have continuously made bug fixes on the release branch.我们不断对发布分支进行错误修复。 Typically we create a topic branch based on the release branch, fix the bug on the topic branch, and merge it to the release branch when done.通常我们基于发布分支创建一个主题分支,修复主题分支上的错误,完成后将其合并到发布分支。
After this, we cherry-pick the merge commit from the release branch to master.在此之后,我们从发布分支中挑选合并提交到 master。
Now to the issue: We have quite a few bug fixes and it is starting to get hard to make sure that they are all cherry-picked.现在问题来了:我们有很多错误修复,并且开始变得难以确保它们都是精心挑选的。 Is there a way to verify that all the fixes on the release branch are also included in master?有没有办法验证发布分支上的所有修复也包含在 master 中?
If you cherry-pick a patch from one branch to another it will get a different commit hash, so you can't rely on that.如果你从一个分支挑选一个补丁到另一个分支,它将得到不同的提交 hash,所以你不能依赖它。
I'd suggest having your own key at the beginning of your commit message (eg, "Bug-12345 Fix memory leak in SomeComponent").我建议在提交消息的开头使用您自己的密钥(例如,“Bug-12345 Fix memory 在 SomeComponent 中泄漏”)。 Then, you could extract the list of bug fixes from each branch, eg:然后,您可以从每个分支中提取错误修复列表,例如:
$ git log --oneline <branchname> | grep '^Bug-' | sort
and then compare the two.然后比较两者。
After some further investigation, I found the answer to my question in a git command that I did not know existed.经过进一步调查,我在一个我不知道存在的 git 命令中找到了我的问题的答案。
git cherry
does the job. git cherry
可以完成这项工作。 The docs say: "The equivalence test is based on the diff, after removing whitespace and line numbers."文档说:“等价测试基于差异,在删除空格和行号之后。” which can be quite useful.这可能非常有用。
To check if the same commits exist in master as the release branch you can run the following command:要检查 master 中是否存在与 release 分支相同的提交,您可以运行以下命令:
$ git cherry master <your_release_branch>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.