美文网首页
[Mac] [git] [completion] [补全]

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

作者: Zhou713 | 来源:发表于2018-09-28 12:41 被阅读0次

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

相关文章

网友评论

      本文标题:[Mac] [git] [completion] [补全]

      本文链接:https://www.haomeiwen.com/subject/wfzuoftx.html