12345678910111213141516171819202122 |
- #!/usr/bin/env bash
- set -euo pipefail
- self=$(git config --get user.name)
- head=$(git head)
- for branch in $(git for-each-ref --format='%(refname:short)' refs/heads/); do
- if [ "$branch" == "$head" ]; then
- continue
- fi
- if git merge-base --is-ancestor "$branch" origin/HEAD; then
- git branch -d "$branch"
- continue
- fi
- author=$(git show --no-patch --pretty='%an' "$branch")
- if [ "$author" != "$self" ]; then
- git branch -D "$branch"
- fi
- done
|