451e51bd88
that prompts if upstream remote branch(es) should be deleted too. As with `git branch`, the function supports multiple branches as params, and also the `-r`/`--remotes` param. Update `gbx` and `gbX` to use this function. Also update `git-stash-clear-interactive` to have multiple tests instead of multiple nested `if`/`then`/`fi`. (Simpler syntax, IMHO)
16 lines
460 B
Bash
16 lines
460 B
Bash
# vim:et sts=2 sw=2 ft=zsh
|
|
local -a remotes
|
|
if (( ${*[(I)-r]} || ${*[(I)--remotes]} )); then
|
|
remotes=(${^*:#-*})
|
|
else
|
|
remotes=(${(f)"$(command git rev-parse --abbrev-ref ${^*:#-*}@{u} 2>/dev/null)"})
|
|
fi
|
|
if command git branch --delete ${@} && \
|
|
(( ${#remotes[@]} )) && \
|
|
read -q "?Also delete remote branch(es) ${remotes} [y/N]? "; then
|
|
print
|
|
local remote
|
|
for remote (${remotes}); do
|
|
command git push ${remote%%/*} :${remote#*/}
|
|
done
|
|
fi
|