Mac git installation and implementation auto-complete

Source: Internet
Author: User
Tags install brew git clone


$ 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

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.