Autocompletion
Git comes with built-in support for the autocompletion of Git commands for the bash
and zsh
shells. If you use either of these shells, you can enable the autocompletion feature and let the <tab>
option help you complete commands.
Getting ready
Generally, the autocompletion feature is distributed with the Git installation, but it is not enabled by default on all platforms or distributions. To enable it, we need to find the git-completion.bash
file distributed/installed with the Git installation.
Linux
For Linux users, the location may vary depending on the distribution. Generally, the file can be found at /etc/bash_completion.d/git-completion.bash
.
Mac
For Mac users, it can generally be found at /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash
.
If you installed Git from Homebrew, it can be found at /usr/local/Cellar/git/2.15.0/etc/bash_completion.d/git-completion.bash
.
Windows
With the Msysgit installation on Windows, the completion functions are already...