By default, git termination expands :
Say you have your own git subcommands (git will run the git-foo program when you run git foo) and you want git f to complete this operation with the command name for you. You can make this subcommand known to completion through the style of the user command:
% zstyle ':completion:*:*:git:*' user-commands foo:'description for foo'
`user-commands' is a list style, so you can add any number of programs there. The: description section is optional, so you can add all git - * programs from your $ path as follows:
% zstyle ':completion:*:*:git:*' user-commands ${${(M)${(k)commands}:
That is, just add
zstyle ':completion:*:*:git:*' user-commands new-branch:'custom new branch function'
on yours zshrc.
, compdef. : , git-<yourcommand>, git .