#compdef gitbmerge #autoload _gitbmerge() { ((CURRENT > 2)) && return # Complete only single branch local gdir branch gdir="$(git rev-parse --git-common-dir 2>/dev/null)" || return local branches=() # TODO ignore current HEAD (merging HEAD to HEAD does not makes sense) while read -r branch; do branches+=("$branch") done < <(find "$gdir/refs/heads" -mindepth 1 -printf '%P\n') _describe -t branches 'gitbmerge' branches } _gitbmerge # vim: ft=zsh