简体   繁体   中英

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.

We have four main-stream branches develop , staging , demo , and master . We follow to create a separate branch for each JIRA ticket and that branch should be deleted once it merged on the origin branch.

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.

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 --format='%(committerdate) %09 %(authorname) %09 %(refname)' --sort=committerdate

You can add a grep on refs/remotes/origin/ to get only remote branches

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?

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