Git is directly installed with yum in CentOS 6.4, and it is expected that the auto-completion function is not provided. It is really painful for children with poor English skills and poor memory.
Recommended reading:
Fedora downloads Git through Http Proxy
Install Git on Ubuntu Server
Create a Git repository on the server (Ubuntu)
Git simple tutorial in Linux (taking Android as an example)
Git authoritative guide PDF
1. Download the source code, mainly using a bash file that automatically complements the command in the source code.
$ Git clone https://github.com/git/git
The git code is hosted on github.com and can be directly cloned. If you are too lazy to clone the file, I have extracted the automatically completed file and can download it directly at the address below.
Git-completion.bash.zip
Free in http://linux.bkjia.com/
The username and password are both www.bkjia.com
The specific download directory is in the/June/10th/CentOS 6.4 Git command to automatically complete the settings
For the download method, see
2. copy the files in the source code directory to the/etc/bash_completion.d/directory.
$ Sudo cp contrib/completion/git-completion.bash/etc/bash_completion.d/
3. Load the file.
$./Etc/bash_completion.d/git-completion.bash
Pay attention to the previous point. After the command is executed, check whether the git command can be automatically completed.
Tips: If you want to enable automatic loading at system startup, You need to modify the/etc/profile file and ~ /. Add the following script to the bashrc file:
if
[ -f
/etc/bash_completion
.d
/git-completion
.
bash
];
then
.
/etc/bash_completion
.d
/git-completion
.
bash
fi
Summary
In the above process, the git version is 1.7.1, and the source code version is the latest downloaded from the official website. The two versions are inconsistent. However, because the function is automatically completed using commands, the relationship should be small. It is better if you can download the source code of the corresponding version.
Git details: click here
Git: click here