After installing Git in the CentOS system, it is found that there is no command automatic completion function, and the Ubuntu system has this function by default, the following is implemented so that CentOS also supports GIT's command automatic completion function.
1 download git source, CD to Contrib/completion directory, find Git-completion.bash file
2 Copy the above file to the personal home directory, can be set to hide the file to avoid subsequent mistakenly deleted
The code is as follows |
Copy Code |
# cd/tmp # git clone https://github.com/git/git # CD git/contrib/completion/ # CP Git-completion.bash ~/.git-completion.bash 3) Edit ~/.BASHRC, add source ~/.git-completion.bash |
# VI ~/.BASHRC
Add the following at the end of the file
SOURCE ~/.git-completion.bash
After completing the above steps, restart the shell, and then enter the GIT command in the future, you will be able to use the TAB key to automatically complete the command