简体   繁体   中英

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.

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.

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?

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.

I'd suggest having your own key at the beginning of your commit message (eg, "Bug-12345 Fix memory leak in 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 cherry does the job. 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:

$ git cherry master <your_release_branch>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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