On my Linux machine I have autocomplete for branches with Git.
[Note we are talking about git branch completion, not bash completion (e.g. commands, files, etc). Thus NOT Lane's answer at all]
For example I can type git checkout
+TAB and get a list of branches.
Or I can type git checkout feb*
+TAB to get all branches that begin with "feb".
How can I get this functionality on a Mac?
I tried downloading and running bash-completion/bash_completion
and bash-completion/bash_completion.sh.in
but no joy. The first gave error messages about declare: -A invalid_option
. The second gave no errors. When I git checkout
+TAB though I am still getting a list of files in the directory, not branches. I am in the project root.
Auto-complete for directories and bash commands are working ok, so it's specific to Git.
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc && . ~/.zshrc
link