在安装了bash-completion的情况下依旧无法补全

解决方法

  1. 新建文件~/.git-completion.bash
  2. 复内容到git-completion.bash中,https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
  3. ~/.bash_profile中新增一行 source ~/.git-completion.bash
  4. 执行 source ~/.bash_profile

bash

curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash && echo "source ~/.git-completion.bash" >> ~/.bash_profile && source ~/.bash_profile