Git supports auto-completion when used via the terminal, which includes all basic commands such as
git status or
git checkout as well as local and remote branch names etc.
It comes pre-installed on Ubuntu, but a few simple steps (bellow) have to be followed to get it working on Mac.
- Open up your terminal app
- Go to your home folder
- Download git completion source file from the official git repo
curl -O https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash. Note: if this link goes dead, just google for the file name
git-completion.bashand you should be able to find the updated link.
- Open your
~/.bash_profilefile (on Mac) or
~/.bashrcfile (on other platforms) with your favorite text editor. i.e.
- Add the following line at the bottom of the file
source ~/git-completion.bashand save the file.
- Close and re-open your terminal or run
. ~/.bash_profileto re-load your setting.
- You should now have working git autocompletion in your terminal shell.
Please let me know in the comment area if you run into any issues.Please Share: