Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 800
Lars Schneider Avatar asked Sep 20 '12 08:09

Lars Schneider


2 Answers

Add this to your .zshrc:

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

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

like image 136
puckipedia Avatar answered Nov 19 '22 16:11

puckipedia


  1. You could edit /usr/share/zsh/functions/Completion/Unix/_git and remove ORIG_HEAD in the following line (line 5091 for me):

    for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do

  2. You could remove .git/ORIG_HEAD :)

like image 20
Stefan Avatar answered Nov 19 '22 16:11

Stefan