git-branch-delete-interactive 446 B

1234567891011121314
  1. # vim:et sts=2 sw=2 ft=zsh
  2. local -a remotes
  3. if (( ${*[(I)(-r|--remotes)]} )); then
  4. remotes=(${^*:#-*})
  5. else
  6. remotes=(${(f)"$(command git rev-parse --abbrev-ref ${^*:#-*}@{u} 2>/dev/null)"}) || remotes=()
  7. fi
  8. if command git branch --delete ${@} && \
  9. (( ${#remotes} )) && \
  10. read -q "?Also delete remote branch(es) ${remotes} [y/N]? "; then
  11. print
  12. local remote
  13. for remote (${remotes}) command git push ${remote%%/*} :${remote#*/}
  14. fi