git 自动补全 (git auto completion)

  1. 下载git-completion.bash 并放到home 目录下:
    curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
  2. 将如下行放到.bash_profile 文件中

    if [ -f ~/.git-completion.bash ]; then
    . ~/.git-completion.bash
    fi
  3. 将其立即生效:
    source ~/.bash_profile

  4. 此时就可以代码补全了,比如我要切换到某个branch,则只需要输入git branch 然后按「TAB」键即可选则需要的branch分支了。

posted @ 2016-01-26 10:14  chenqiangzhishen  阅读(342)  评论(0编辑  收藏  举报