[Mac] [git] [completion] [补全]

git 用 [TAB] 键自动补全的问题
Mac :10.13.6
git :随着 Xcode 安装的版本:git version 2.17.1 (Apple Git-112)
使用的是 bash

先决条件:
获取 git 源码目录下 git/contrib/completion/git-completion.bash 文件到本地

方法一:
source git-completion.bash

方法二:
brew install bash-completion
(按提示配好 .bash_profile )
cp git-completion.bash /usr/local/opt/bash-completion/etc/bash_completion.d
brew unlink bash-completion
brew link bash-completion

遇到问题:
git 补全时显示:
unknown option: --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]

解决(偷懒):
使用 5月8号之前的 git-completion.bash ,获得方法:拉取 git 源码,checkout 回 May 8 的提交,获取此 git/contrib/completion/git-completion.bash

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,948评论 18 139
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,504评论 0 13
  • 离开如画般的宏村,芜湖成了我们的第三站。 酒店在镜湖旁,进到大堂就看到陈列架上的书籍,前台看到有...
    哎呦哇阅读 1,103评论 1 1
  • 如果有人问 生离死别 你更喜欢哪一种 我一定会选择死别 生离是一种无法弥补的遗憾 而死别是无法选择的妥协
    他叫我七月阅读 179评论 2 4
  • Core GraphicsQuartz 2D 所有的控件, 都是通过该方法将自身绘制出来的 以上方法只有自定义绘图...
    xwf_code阅读 310评论 0 0