git config --global alias.checkoutr checkout
$EDITOR /usr/local/share/zsh/site-functions/git-completion.bash
...and then modify the file as follows...
-__gitcomp_nl "$(__git_refs '' $track)"
+if [ "$command" = "checkoutr" ]; then
+ __gitcomp_nl "$(__git_refs '' $track)"
+else
+ __gitcomp_nl "$(__git_heads '' $track)"
+fi
... and source your shell (source ~/.bashrc
/ source ~/.zshrc
...).
Use git checkoutr
for the default behavior and git checkout
(or just gco
) for browsing only local branches. Credits to http://cmetcalfe.ca/blog/git-checkout-autocomplete-local-branches-only.html.
I finally figured this out for anyone wondering. I had to change the implementation defined within the
gitfast
plugin directory.For me this was located here:
~/.oh-my-zsh/plugins/gitfast/git-completion.bash
Changes that work
The suggestion by @ekoneko to remove
$dwim_opt
Changes that do not work
Note you do NOT need to set
checkout.guess = false
in your.gitconfig
. I found by doing so, it actually broke the ability to usegit checkout
for local search andgit checkoutr
for remote search.