Mac 环境下 git 如何自动补全

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

内容简介:将下面代码添加到~/.bash_profile(如果没有该文件,新建一个)。这个文件不能随便安装,网上的教程都是用git参数的master分支,这是不对的,这个版本需要和当前系统安装的git版本对应。看看自己的版本是什么,我的是

安装 bash-completion

brew install bash-completion

将下面代码添加到~/.bash_profile(如果没有该文件,新建一个)。

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

安装 git-completion.bash

这个文件不能随便安装,网上的教程都是用git参数的master分支,这是不对的,这个版本需要和当前系统安装的git版本对应。

git version

看看自己的版本是什么,我的是 2.17.1 ,就需要用这个 版本的脚本 。将脚本报存到 ~/.git-completion.bash 里面,然后执行:

source ~/.git-completion.bash
source ~/.bash_profile

这样就可以咯,按下Tab键就可以提示啦。

$ git che
checkout      cherry        cherry-pick

更多阅读: .git-completion.bash producing error on macOS Sierra 10.12.6


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

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

Introduction to Algorithms, 3rd Edition

Introduction to Algorithms, 3rd Edition

Thomas H. Cormen、Charles E. Leiserson、Ronald L. Rivest、Clifford Stein / The MIT Press / 2009-7-31 / USD 94.00

Some books on algorithms are rigorous but incomplete; others cover masses of material but lack rigor. Introduction to Algorithms uniquely combines rigor and comprehensiveness. The book covers a broad ......一起来看看 《Introduction to Algorithms, 3rd Edition》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码