Show all branches that commit A is on and commit B is not on?

I have multiple branches and have discovered a commit A that introduced a bug into the system. This was subsequently fixed by commit B on one of the branches and merged back to master, but at the time it was not cherry-picked to all offending branches.

I was wondering if there is a command that will show all offending branches that have commit A but do not have commit B?

I have been using the following to determine that a commit exists on a branch

$ git branch -r --contains=A

but I want to try and add to this to include something like

$ git branch -r --contains=A ^--contains=B

As a side note I have checked and there are no other commits that contain the same change, ie it has not been cherry-picked on to any other branches, but some branches have commit B where they have diverged from master since the merge and some don't where they already existed before commit B was introduced.

Additionally the ability to check for several commits would be useful where the commit that has fixed an issue (commit B in this case) is cherry-picked onto several branches already giving different commit SHA's.


Have you tried this:

diff <(git branch -r --contains=A) <(git branch -r --contains=B)

It is far from perfect but it might help.

链接地址: http://www.djcxy.com/p/10654.html

上一篇: 在variadic模板中使用垫片更简洁的方法?

下一篇: 显示所有提交A的分支并且提交B不在?