Enable git completion on zsh of MacOS

New versions of MacOS use zsh instead of bash as the default terminal shell. By default, zsh does not support auto completion of the git installation in the developer tools.

Solution

Add the following line to your ~/.zshrc file:

autoload -Uz compinit && compinit

Then restart the terminal, and your git command is now able to auto complete.

Posted on 2023-08-21