machine_setup/ansible/roles/base/files/git_find_merged_branches
2022-10-28 01:10:07 -04:00

6 lines
309 B
Bash

#!/usr/bin/env bash
#
#
git checkout -q master && git for-each-ref refs/heads/ "--format=%(refname:short)" | while read branch; do mergeBase=$(git merge-base master $branch) && [[ $(git cherry master $(git commit-tree $(git rev-parse "$branch^{tree}") -p $mergeBase -m _)) == "-"* ]] && echo "$branch"; done