From 7a5a85e7117cd1ad05dda0e6538d0bf31760801a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Grondek?= Date: Thu, 28 Nov 2019 11:15:35 +0100 Subject: [PATCH] [git] Fix git-purge --- git/bin/git-purge | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/git/bin/git-purge b/git/bin/git-purge index aad3a94..6ebacbe 100755 --- a/git/bin/git-purge +++ b/git/bin/git-purge @@ -1,3 +1,9 @@ #!/usr/bin/env sh -git branch --merged|egrep -v "(^*|master|dev)" | xargs git branch -d +BRANCHES=$(git branch --merged|egrep -v "(^\*|master|dev)") + +if [ -z "${BRANCHES}" ] ; then + echo "Nothing to delete" +else + git branch -d ${BRANCHES} +fi