#!/bin/sh # Delete the local branches whose upstream branch was deleted on the remote # # `git branch --delete` without "--force" is used, # so branches holding unmerged commits are kept # # Usage: git prune-delete set -eu _branches=$(git prune-show) if [ -z "$_branches" ]; then echo "No branches to prune" exit 0 fi # shellcheck disable=SC2086 # because branch names never contain whitespace git branch --delete $_branches