Skip to content

Commit

Permalink
helper for branch cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kiemlicz committed Aug 9, 2024
1 parent 38629e8 commit 52844a7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/git_functions
Original file line number Diff line number Diff line change
Expand Up @@ -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 <base_dir> <branch_to_remove>"
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
}

0 comments on commit 52844a7

Please sign in to comment.