#!/bin/sh . "$HOME/.shenv" . "$HOME/lib/tputfs.sh" if [ ! "$1" = "-y" ]; then status Are you sure you want to delete ALL git branches matching status "patch-queue/* in all git repos matching ~/src/* ?" status Press enter to confirm or hit C-c to abort read _ fi for repo in $HOME/src/*; do if [ -d "$repo/.git" ]; then cd "$repo" branches="$(git branch | grep ' patch-queue/*' | cut -c3-)" for branch in $branches; do git branch -D "$branch" echo " in repo $(basename $repo)" done fi done