简体   繁体   English

获取 github 上合并分支的列表以及分支创建者

[英]Get List of merged branches on github along with branch creator

We have a team of 50+ developers and people do not delete their feature branches after merging them on the main-stream branch.我们有一个由 50 多名开发人员组成的团队,人们在将功能分支合并到主流分支后不会删除它们。

We have four main-stream branches develop , staging , demo , and master .我们有四个主流分支developstagingdemomaster We follow to create a separate branch for each JIRA ticket and that branch should be deleted once it merged on the origin branch.我们遵循为每个 JIRA 票证创建一个单独的分支,并且该分支一旦合并到源分支上就应该被删除。

So I want to get the list of all merged branches along with the creator to prepare the stats but could not find a proper way to do this.所以我想与创建者一起获取所有合并分支的列表来准备统计信息,但找不到合适的方法来做到这一点。 Find multiple answers on StackOverflow but could not find any suitable.在 StackOverflow 上找到多个答案,但找不到合适的答案。

Use git for-each-ref with --merged=HEAD to filter on merged branch then use a format to get the committer by getting the last person to commit to that branch.使用git for-each-ref--merged=HEAD过滤合并的分支,然后使用格式通过让最后一个人提交到该分支来获取提交者。

git for-each-ref --merged=HEAD --format='%(committerdate) %09 %(authorname) %09 %(refname)' --sort=committerdate

You can add a grep on refs/remotes/origin/ to get only remote branches您可以在refs/remotes/origin/上添加grep以仅获取远程分支

git for-each-ref --merged=HEAD --format='%(committerdate) %09 %(authorname) %09 %(refname)' --sort=committerdate | grep 'refs/remotes/origin/'

From Find out a Git branch creator and How can I know if a branch has been already merged into master?查找 Git 分支创建者我如何知道分支是否已合并到 master 中?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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