根据个人实践,本功能的实现要求 git 是通过 Homebrew 安装的。其他方式安装的不起作用,具体原因不详。
安装 bash-completion
使用 Homebrew 安装
brew install bash-completion
修改 ~/.bash_profile
在 ~/.bash_profile 中添加下方代码:
if [ -f $(brew --prefix)/etc/bash_completion ]; then. $(brew --prefix)/etc/bash_completionfi
