From 16041010f4be4f89e5c5953372a0a4930f8b104b Mon Sep 17 00:00:00 2001 From: PCOffline Date: Wed, 2 Jul 2025 01:58:19 +0300 Subject: [PATCH] gbdsdry --- plugins/git/git.plugin.zsh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 1d043da35..d6629fcb2 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -147,6 +147,19 @@ function gbds() { done } +function gbdsdry() { + local default_branch=$(git_main_branch) + (( ! $? )) || default_branch=$(git_develop_branch) + + git for-each-ref refs/heads/ "--format=%(refname:short)" | \ + while read branch; do + local merge_base=$(git merge-base $default_branch $branch) + if [[ $(git cherry $default_branch $(git commit-tree $(git rev-parse $branch\^{tree}) -p $merge_base -m _)) = -* ]]; then + echo $branch + fi + done +} + alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -d' alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -D' alias gbm='git branch --move' @@ -165,7 +178,6 @@ alias gcpa='git cherry-pick --abort' alias gcpc='git cherry-pick --continue' alias gclean='git clean --interactive -d' alias gcl='git clone --recurse-submodules' -alias gclf='git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules' function gccd() { setopt localoptions extendedglob