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
网友评论