From d0aee7e638bdeaa04f4ad14a1b9976ebe4a85d51 Mon Sep 17 00:00:00 2001 From: druckdev Date: Sun, 16 May 2021 00:04:46 +0200 Subject: [PATCH] zsh:alias:git-base-branch: Fix small pattern error In place of the in ed215a35f7d965185f6bb939053e728ffdd16080 introduced second bracket can also stand `~` or `^`. Otherwise something like `[feature^] or [feature~2]` is not thrown out. --- .config/zsh/zshrc.d/30-alias.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/zsh/zshrc.d/30-alias.zsh b/.config/zsh/zshrc.d/30-alias.zsh index 1d62c03..d9ab96f 100644 --- a/.config/zsh/zshrc.d/30-alias.zsh +++ b/.config/zsh/zshrc.d/30-alias.zsh @@ -35,7 +35,7 @@ # https://nilansanjaya.wordpress.com/2017/06/02/git-find-base-branch/ git_bb='git show-branch -a 2>/dev/null' git_bb+=' | grep "^[^[]*[*-].*\["' - git_bb+=' | grep -v "^[^[]*\[$(git rev-parse --abbrev-ref HEAD)\]"' + git_bb+=' | grep -v "^[^[]*\[$(git rev-parse --abbrev-ref HEAD)[]~^]"' git_bb+=' | head -n1' git_bb+=' | sed -E "s/^[^[]*\[([^]~^]*).*$/\1/"' alias git-base-branch="$git_bb"