ohmyzsh: Git branch completion doesn't work
Hey, I have browsed a number of threads regarding this beyond counting.
I want to be able to hit <TAB> after git checkout and see a list of the local
branches that exist in my repository. I was told this would work as-is when I installed
zsh and oh-my-zsh from brew. It didn’t, so I tried to debug it in the following ways:
- Added
gitto my plugins. Then I investigated and it only defines a list of aliases - Added
gitfastto my plugins. It ships with agit-completion.bashscript, but it never sources it anywhere - Tried downloading those scripts: git-completion.bash and git-completion.zsh and sourcing the latter.
I also tried each of those steps after removing
~/.zcompdump*.
Perhaps someone with a deeper insight could help. Attachments:
The tab completion suggests file names for checkout:

About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 16 (8 by maintainers)
Commits related to this issue
- git: remove some options — committed to Homebrew/homebrew-core by fxcoudert 6 years ago
I’m going to leave this here on the off chance someone else is converting from bash and doesn’t have all the zsh magic set up in ~/.zshrc
Everything was all set already; it just needed autoload and compinit then it all just worked after
exec zsh.Disable the gitfast plugin, then run
rm $ZSH_COMPDUMPand restart the shell. It should be solved.Disable the gitfast plugin and make sure you didn’t install Homebrew’s git completion. It shouldn’t matter but try that anyway. You can find git completion files by running:
Homebrew’s provided completion should be in
/usr/local/share/zsh/site-functions. Try disabling read permissions to that file, delete zcompdump cache files (rm ~/.zcompdump*), thenexec zsh. If that was the issue, git checkout completion should work.Related: #7062
I’m having the same issue. I had this working on another machine. I’ll check the setup when I can and post back if there isn’t a reply that answers this issue.
Have you tried
rm ~/.zcompdump*, then restarting the shell? What doeswhich $_comps[git]show?