Manually executing bash is just as simple:
_gitpull_complete() {
branches=$(git branch -l | cut -c3-)
COMPREPLY=($(compgen -W "$branches" -- "$2"))
}
complete -F _gitpull_complete gitpull
After searching for the above commands:
$ gitpull <TAB>
asd master qwe zxc
$ gitpull m<TAB>
$ gitpull master
The final link to bash termination is (of course) the "Programmable Termination" section of the bash manual, but a nice introduction is provided on the Debian Administration page ( part 1 and more important part 2 ).