My zsh does git completion, but I did not configure this myself. How can I figure out where these settings are coming from?
zsh comes with its own completion library which includes completions for Git commands. Once you enable zsh’s completion, these bundle completions will be available.
You usually enable and configure zsh completion by running
autoload -U compinstall && compinstall). It will modify your
.zshrc to include
autoload -Uz compinit and
compinit so that completion is initialized for each instance of zsh.
compinit automatically loads completions from zsh’s
fpath directories (see the “Autoloaded files” section of the
For example, my system has two versions of zsh installed:
/bin/zshgets Git completions from
/opt/local/bin/zshgets Git completions from
The directories of these
_git files are in the respective shell’s
fpath (which also includes
site-functions directory that is next to the version directory).