diff --git a/bin/remove-merged-branches b/bin/remove-merged-branches deleted file mode 100755 index c11df403..00000000 --- a/bin/remove-merged-branches +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -if [ -n "$1" ]; then - BRANCH="$1" -else - BRANCH=`git branch| awk '{print $NF}' | fzf --prompt '(base branch) > '` -fi - -if [ -z $BRANCH ]; then - echo "Select valid branch" - exit 1 -fi - -echo "Log: base branch: $BRANCH" -git branch --merged $BRANCH | grep -v $BRANCH | xargs -r git branch -d diff --git a/git/config.d/config b/git/config.d/config index 92c880bf..585b2b5a 100644 --- a/git/config.d/config +++ b/git/config.d/config @@ -6,7 +6,19 @@ rebase = false [alias] - remove-merged = !remove-merged-branches + remove-merged = "!f() { \ + if [ -n \"$1\" ]; then \ + BRANCH=\"$1\"; \ + else \ + BRANCH=$(git branch | awk '{print $NF}' | fzf --prompt '(base branch) > '); \ + fi; \ + if [ -z \"$BRANCH\" ]; then \ + echo \"Select valid branch\"; \ + exit 1; \ + fi; \ + echo \"Log: base branch: $BRANCH\"; \ + git branch --merged \"$BRANCH\" | grep -v \"$BRANCH\" | xargs -r git branch -d; \ + }; f" [format] pretty = format:%C(yellow)%h %C(green)%cd %C(reset)%s %C(red)%d %C(cyan)[%an]