Mac git command auto-complete

Source: Internet
Author: User
Tags install brew

$ 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.