I was directed to this repo by claude when I asked for an alternative to my adhoc
bash (or zsh?) script I used for a while
git_brd_merged_HEAD () {
mode="$1"
shift
branches_regex="${1:-\(gh\|temp\|bm\|bf\|rf\|opt\|bug\|fix\|rm\|pr\|enh\|nf\)[-/]}"
branches=(`git branch --merged HEAD | grep -e "^ *$branches_regex" | sed -e 's/^ *//g' `)
{
for branch in ${branches[@]}
do
t="$(git describe --contains --match '[v0-9]*.[0-9]*' $branch 2>/dev/null)"
rbr=`git config branch.$branch.remote`
case $mode in
(info) echo "Q: Branch: $branch remote: $rbr contained describe: $t"
continue ;;
(doit) git_brd "$branch" ;;
(ask) while true
do
echo -n "Q: Branch: $branch remote: $rbr contained describe: $t Delete [y/n] or gitk [g]? "
read answer
if [ "$answer" = "g" ]
then
echo
gitk --select-commit="$branch" HEAD
continue
fi
break
done
[ "$answer" = "y" ] && {
echo
git_brd "$branch"
} || {
echo "skipped $branch"
} ;;
(*) echo "Modes are info, doit, ask" >&2
break ;;
esac
done
} 3<&0
}
and I loved git dmb! well done -- thanks! But it makes me scared to say yes to e.g. deletion of 20+ (or more) branches without extra information on whether that branch was merged or cherry-picked or released in some release already. Also in above shell script of mine I have g to start gitk for that branch@commit so I could visually confirm that it is ok to delete (usually cherry-picked commit nearby).
I think it would have been great that in addition to plain listing of the branches, it showed details on detection (merged or cherry-picked, squashed), # of commits, and in which release that observed 'cherry picked' state was released (that might be tricky unless merged ; I guess). WDYT?
I was directed to this repo by claude when I asked for an alternative to my adhoc
bash (or zsh?) script I used for a while
and I loved
git dmb! well done -- thanks! But it makes me scared to say yes to e.g. deletion of 20+ (or more) branches without extra information on whether that branch was merged or cherry-picked or released in some release already. Also in above shell script of mine I havegto start gitk for that branch@commit so I could visually confirm that it is ok to delete (usually cherry-picked commit nearby).I think it would have been great that in addition to plain listing of the branches, it showed details on detection (merged or cherry-picked, squashed), # of commits, and in which release that observed 'cherry picked' state was released (that might be tricky unless merged ; I guess). WDYT?