mac git添加自动补全

引用自:https://www.jianshu.com/p/7130a5c11d42

 

请参照以下步骤##

  • 1.查看是否已经安装了bash-completion,如果没有请使用以下命令安装
    brew install bash-completion
  • 2.执行brew info bash-completion命令
$brew info bash-completion 

Add the following lines to your ~/.bash_profile:

  if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion
  fi
  • 3.将第二步中的if..then...fi语句添加到~/.bash_profile文件中(如果没有该文件,新建一个)
  • 4.重启终端

以上为安装bash-completion部分###

  • 5.将Git源码clone到本地
    $ git clone https://github.com/git/git.git
    小提示:如果不希望clone整个项目,可以直接将项目中的contrib/completion/git-completion.bash的内容拷贝出来保存到保存到~/.git-completion.bash,该提示等效于第六步
  • 6.找到contrib/completion/git-completion.bash,将该文件拷贝到~/下并重命名为.git-completion.bash
$ cp git-completion.bash ~/.git-completion.bash
  • 7.在~/.bash_profile文件(这里原作者应该是弄错了,如果没有就新建一个)中添加如下内容
source ~/.git-completion.bash

重启终端就可以了##

$ git remote [tab]
add            remove         set-branches   set-url        update         
prune          rename         set-head       show 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值