简体   繁体   English

在 git 中,我如何验证 bug 修复在 Release 分支和 master 中

[英]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.

相关问题 如何验证git项目的release分支的修补程序已全部合并到master中? - How can I verify that a git project's release branch's fixes have all been merged into master? 合并错误修复补丁从发布分支到主分支 - Merge bug fixes patches from release branch to master branch 如何将我的 Git &#39;master&#39; 分支重命名为 &#39;release&#39;? - How do I rename my Git 'master' branch to 'release'? 如何创建与主分支和生产分支合并的Git分支 - How do I create a Git branch that merges with both the master branch and production branch 是否有一个gitflow进程用于分支和错误修复与发布分支? - Is there a gitflow process for branching and bug fixes with a release branch? 当它是前后两个时,我如何抓住一个git分支来掌握它? - How do I catch a git branch up to master when it is both ahead and behind? 如何自动化master分支的git版本发布? - How to automate git version release of master branch? 如何用 Git 中的开发分支替换主分支? - How do I replace the master branch with a development branch in Git? 如何将本地 Git 分支推送到远程的 master 分支? - How do I push a local Git branch to master branch in the remote? 我是否需要为bug修复创建新分支或在git中使用master分支 - Do i need to make new branch for bug fix or work on master branch in git
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM