Search code examples
gitzshzsh-completion

Ignore ORIG_HEAD in zsh git autocomplete


I use oh-my-zsh and git autocompletion.

If I type git checkout org and hit TAB I get these results:

ORIG_HEAD
origin/HEAD
origin/mybranch

How can I make the autocompletion to ignore ORIG_HEAD?


Solution

  • Add this to your .zshrc:

    zstyle ':completion:*:*' ignored-patterns '*ORIG_HEAD'
    

    This will ignore all files ending with ORIG_HEAD when multiple files exist.