$ brew List
If not, copy the following command to the terminal to enter. Ready to install Brew
Ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. See if you have installed the "bash-completion",如果没有,继续往下看:
$ Brew Install Bash-completion
# # # # #安装完成之后 ######
?
3. Check to see if your Mac can display hidden files (files that begin with.) If you cannot copy the following command to Terminal return
Defaults write Com.apple.finder Appleshowallfiles-boolean true; Killall Finder
4. Add the following code to ~/.bash_profile (if there is no file, create a new one) Note: ~/represents your Mac's personal directory
If [-f ~/.git-completion.bash]; Then
. ~/.git-completion.bash
Fi
Note: If Git is not installed. Install git with the following command
5. Then clone the git source to a local
$ git clone https://github.com/git/git.git
6. Find the "contrib/completion/" directory under the Git-completion.bash, can not find a spotlight search Git-completion
Copy the file to the ~/directory and rename it to. Git-completion.bash
$ CP Git-completion.bash ~/.git-completion.bash
7. Add the following in the ~/.BASHRC file (if not in this directory, create a new one)
SOURCE ~/.git-completion.bash
7. OK, after restarting the terminal, it's done. Git auto-Complete directly a tab if you press one tab, your input can match multiple commands.
Press TAB two times to prompt for all matching commands
$ git--h[tab][tab]--help --html-path
Mac git installation and implementation auto-complete