machine_setup/ansible/roles/base/files/git_find_merged_branches

6 lines
309 B
Plaintext
Raw Normal View History

2022-10-28 05:10:07 +00:00
#!/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