I am using zsh with oh-my-zsh on Ubuntu 18.04.2. Currently, Git is installed at version 2.20.1.

Whenever I want to push a local branch to a remote (origin) I try to use the tab completion in the shell as follows:

git push origin fea<TAB>

The tab completion results in:

git push origin origin/feature

I cannot push to origin/feature, though. What I actually want is:

git push origin feature

The same applies to git checkout.

How can I configure the tab completion to correctly (?) complete the remote branch - or am I missing something?

  • oh-my-zsh's git plugin comes with an alias to do this: ggp.
    – jordanm
    Apr 26, 2019 at 22:41
  • @jordanm While ggp might help with push it does not help with checkout.
    – JJD
    May 7, 2019 at 8:08

1 Answer 1


This could be a clash between git's own completion and oh-my-zsh's one.

I found a working solution here: https://www.raphael-brugier.com/blog/fix-git-completion-zsh-mac-homebrew/

Depending on your environment, you might therefore want to disable git completion in your .zshrc:

compdef -d git

Also, upgrading your Zsh version seems to help, as this kind of issue is reported as fixed on Zsh 4.3.10 and later.

  • If I disable the git completion then there is no completion for origin or branch names and the like. Maybe, something about my completions configuration is just wrong.
    – JJD
    May 18, 2019 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.