From 52844a743e932d47df68e4ea476e1d4062734b7a Mon Sep 17 00:00:00 2001 From: kiemlicz Date: Fri, 9 Aug 2024 09:24:12 +0200 Subject: [PATCH] helper for branch cleanup --- core/git_functions | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/git_functions b/core/git_functions index c82555c..f75b382 100755 --- a/core/git_functions +++ b/core/git_functions @@ -3,3 +3,19 @@ git_untracked() { git ls-files . --exclude-standard --others } + +multirepo_branch_del() { + local base_dir="$1" + local branch_to_remove="$2" + if [ -z "${branch_to_remove}" ]; then + echo "Usage: $0 " + return 4 + fi + echo "Branch: $branch_to_remove removal in all repositories under: $base_dir" + for dir in "$base_dir"/*/; do + if [ -d "$dir/.git" ]; then + echo "Removing branch $branch_to_remove in $dir" + (cd "$dir" && git branch -d "$branch_to_remove") + fi + done +}