[英]How to get list of branches “merged” to git tag
We are tagging master with release number. 我们正在使用发行版号标记master。 I want to get list of branches that were merged to master branch before a specific release tag was created.
我想获取在创建特定发行标签之前已合并到主分支的分支列表。
I could do it by hand calling git tag --contains last_commit_of_each_branch
but I'm lazy. 我可以手动调用
git tag --contains last_commit_of_each_branch
但我很懒。
Is there a better way to do it? 有更好的方法吗? Or should I just script getting all branches and calling
contains
for last commits in each of those? 还是我应该只编写脚本以获取所有分支并调用
contains
的最后一个提交的contains
?
First , find the branches which were merged into master
by git branch --merged master
. 首先 ,找到被
git branch --merged master
合并为master
的git branch --merged master
。 Assume the branches merged into master
are branch1
, branch2
,…, branchn
. 假设合并到
master
中的分支是branch1
, branch2
,…, branchn
。
Second , check if a branch or some branches added tags on the last commit of each branch. 其次 ,检查一个或多个分支是否在每个分支的最后一次提交上添加了标签。
Check if branchx
added tag on the last commit: git tag --contains branchx
. 检查
branchx
是否在上一次提交时添加了标签: git tag --contains branchx
。
Check if branchm
and branchn
added tags on the last commits: git tag --contains branchm --contains branchn
. 检查
branchm
和branchn
是否在最后一次提交时添加了标签: git tag --contains branchm --contains branchn
。
Of cause, you can use script to achieve it and it's more time saving. 当然,您可以使用脚本来实现,这样可以节省更多时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.