Git Autocomplition for macOS
There are two ways for it.
By far the easiest way to install git-completion is below -
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash && echo "source ~/.git-completion.bash" >> ~/.bash_profile && source ~/.bash_profile
You just need to copy above line and execute it in terminal.
Another way,
Install both Git and git-completion is via Homebrew, so you should pick that one.
brew install git && brew install bash-completion
Note: If you already have git installed then just execute below command -
brew install bash-completion
and then add bash-completion to your ~/.bash_profile:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
After all either execute .bash_profile or just open a new terminal.
Congrats your git bash autocompletion is now working.
Hope this helps
comments powered by Disqus