git 添加tab补全

  1. 从github获取 git-completion.bash
  2. git-completion.bash放在/etc/bash_completion.d/ 目录中 cp ./git-completion.bash /etc/bash_completion.d/git-completion.bash
  3. ~/.bashrc中添加如下代码
    if [ -f /etc/bash_completion.d/git-completion.bash ]; then
        . /etc/bash_completion.d/git-completion.bash
    fi
    
  4. 执行source ~/.bashrc使其生效
  5. ~/.bashrc的执行依赖于~/.bash_profile如果~/.bash_profile不存在则创建该文件并添加如下代码
    if [ -f ~/.bashrc ]; then
        . ~/.bashrc
    fi
    
posted @ 2017-05-26 13:00  junlyde  阅读(1035)  评论(0编辑  收藏  举报