mac git命令按tab键自动补全

栏目: 编程工具 · 发布时间: 7年前

内容简介:mac上命令行比windows好用很多,但是git默认按tab键是不会自动补全的,很不爽。下面我们按步骤来介绍怎么做到自动补全。1.安装home-brew,相应大家装装过了,如果没装,直接去官网看下命令行,copy过来装下就好了。2.执行

mac上命令行比windows好用很多,但是git默认按tab键是不会自动补全的,很不爽。下面我们按步骤来介绍怎么做到自动补全。

1.安装home-brew,相应大家装装过了,如果没装,直接去官网看下命令行,copy过来装下就好了。

2.执行 brew install bash-completion

3.

if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi

把上面这段代码copy到 ~/.bash_profile 中,如果没有,就创建下这个文件,怎么创建文件?touch .bash_profile

4.打开 https://github.com/git/git/bl... ,把这个文件下下来,然后

cp git-completion.bash ~/.git-completion.bash 这个命令意思就是把这个文件拷贝到 ~/目录下,并且名字前面加了个点。

5.在~/.bashrc文件(该目录下如果没有,新建一个)中添加下边的内容

source ~/.git-completion.bash

6.运行

test -f ~/.git-completion.bash && . $_

然后重启终端,试试按tab键吧。git命令就自动补全了。


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Cult of the Amateur

The Cult of the Amateur

Andrew Keen / Crown Business / 2007-6-5 / USD 22.95

Amateur hour has arrived, and the audience is running the show In a hard-hitting and provocative polemic, Silicon Valley insider and pundit Andrew Keen exposes the grave consequences of today’s......一起来看看 《The Cult of the Amateur》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具