From 82018c76a29484df7deb0004b481026f8a06ceab Mon Sep 17 00:00:00 2001 From: bretello Date: Tue, 17 Mar 2020 15:03:49 +0100 Subject: [PATCH] functions: add git_prune_branches --- functions.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/functions.sh b/functions.sh index b8fbe93..1066442 100755 --- a/functions.sh +++ b/functions.sh @@ -232,6 +232,7 @@ function pipupdate(){ done } +# unzip file to directory with the same name of the zip file (without extension) function unzipd { zip_file="$1" filename=$(basename -- "$zip_file") @@ -240,6 +241,12 @@ function unzipd { unzip -d "$name" "$zip_file" } +# remove local branches which have been merged into master +function git_prune_branches(){ + git branch --merged master | grep -v '^[ * ]*master$' | xargs git branch -d +} + + # dotfiles user functions if [[ -f $HOME/.dotfiles_functions ]]; then source "$HOME/.dotfiles_functions"