git completion in zsh

Just figured out how to get git tab completion working in zsh on a Mac. Turns out that the completion scripts use a bunch of extra git commands such as git-ls-files. These commands need to be in your path for the completion to work. If you installed git using the OS X installer, you need to add this directory to your path:

/usr/local/git/libexec/git-core
This entry was posted in OS X, SCM, Shells and tagged , , , . Bookmark the permalink.

3 Responses to git completion in zsh

  1. Bjørn Arild Mæland says:

    Thanks for posting, this fixed my problem. :)

  2. GJ says:

    Just what I was look for, great :)

  3. Arild Shirazi says:

    Thanks a bunch! Not having completion was driving me crazy.

    Since this is for Mac OS X, I thought I would pass along another tip for adding to the PATH. /usr/libexec/path_helper looks for files in /etc/paths.d and appends their contents to the PATH.

    Thus to get git tab completion on my Mac:
    echo “/usr/local/git/libexec/git-core” | sudo tee -a /etc/paths.d/git

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>