Search code examples
gitzshoh-my-zshzsh-completion

Git tab completion stopped working on remote branches


I've updated git to its latest version (2.29.0) and I'm using ZSH 5.8.

I used to switch between branches with git checkout remote_br<tab> to quickly switch between branches, even if the branch is only a remote one atm. I've seen git has made a lot of changes regarding switch/checkout recently, the thing is my autocompletion on remote branches doesn't work anymore (with checkout or switch).

I've tried to add the latest version of contrib/completion/git-completion.zsh to my zsh, but I still have my issue. Am I missing something here ?


Solution

  • Try the following patch:

    --- a/git-completion.zsh
    +++ b/git-completion.zsh
    @@ -97,6 +97,11 @@ __gitcomp_direct ()
            compadd -Q -S '' -- ${(f)1} && _ret=0
     }
     
    +__gitcomp_direct_append ()
    +{
    +       __gitcomp_direct "$@"
    +}
    +
     __gitcomp_nl ()
     {
            emulate -L zsh
    

    In general it's better to report bugs to the git mailing list, however, I'm the maintainer of the zsh code, which is more up to date in my fork: git-completion.