From 777ea7772198d907f818df15f7e8114390379cc3 Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 24 May 2024 15:41:11 +0100 Subject: less aggressive killmerged --- .bash_profile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.bash_profile b/.bash_profile index 7ba48f2..03b8734 100644 --- a/.bash_profile +++ b/.bash_profile @@ -45,8 +45,14 @@ function pm() { } function killmerged() { - for b in $(git branch --merged HEAD --no-contains HEAD|grep -vE 'stage|master|svn|develop'); do - git branch -d $b && git push origin :$b + local -a branches=( $( \ + git branch --merged HEAD --no-contains HEAD --format '%(refname)' | \ + grep -vE '^refs/heads/(stage|master|svn|develop|uat|stable|live-testing)$' \ + ) ) + branches=( "${branches[@]#refs/heads/}" ) + for b in "${branches[@]}" + do + git branch -d $b done } -- cgit v1.2.3