mac git tab tab 无效

来源:互联网 发布:程不时 知乎 编辑:程序博客网 时间:2024/04/27 21:33

$ brew list
查看你是否已经安装了”bash-completion”,如果没有,继续往下看:
$ brew install bash-completion
安装完成之后
$ brew info bash-completion
下边这句话很重要

==> CaveatsAdd the following lines to your ~/.bash_profile:if [ -f $(brew --prefix)/etc/bash_completion ]; then. $(brew --prefix)/etc/bash_completionfi

将if…then…那一句添加到~/.bash_profile(如果没有该文件,新建一个)
重启终端,以上为安装bash-completion部分。
接下来将git源码clone到本地
$ git clone https://github.com/git/git.git
找到”contrib/completion/”目录下的git-completion.bash,将该文件拷贝到~/下并重命名为.git-completion.bash
$ cp git-completion.bash ~/.git-completion.bash
在~/.bashrc文件(该目录下如果没有,新建一个)中添加下边的内容
source ~/.git-completion.bash
好了,重启终端以后就大功告成了
$ git --h[tab][tab]--help --html-path

0 0
原创粉丝点击