The answers given in Disable auto-completion of remote branches in Zsh? no longer work, as zsh has changed the way it does this in the last six years.
I've hacked up a version of the __git_refs function which does not list remotes, and stored the definition in ~/.zsh-functions/__git_refs. The file starts with unfunction __git_refs 2> /dev/null to be sure the system function definition is removed.
If I source ~/.zsh-functions/__git_refs then type git checkout <Tab>, I see only local branches, which is correct.
But if I add source ~/.zsh-functions/__git_refs to the end of my .zshrc and launch a new zsh, I still get the system version of the function, and the completion shows remote branches as well as local ones.
How can I override this function without having to type source ~/.zsh-functions/__git_refs each time I launch a shell?
(Alternatively, is there a cleaner way of getting zsh to only show local branches in completions that still works on zsh 5.6.2?)