$ brew List
If not, copy the following command to the terminal to enter. Ready to install Brew
" $ (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
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.bashfi
How to add new content:
1 . Start Terminal terminal 2 . Go to the home directory of the current user ~3.create a. Bash_profile input touch. Bash_profile4. Edit the. bash_profile file -E. Bash_profile
5. Then clone the Git source to a local
$ git clone https://github.com/git/git.git //copy for a long time O (╯-╰) o
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
8. 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 command auto-complete