Disable auto-completion of remote branches in Git Bash?

后端 未结 9 1489
广开言路
广开言路 2020-11-30 01:59

I\'m working on a fairly large git repo with a couple of thousand (remote) branches. I am used to using auto-completion (using [TAB]) in the console (Git Bash in that case),

9条回答
  •  失恋的感觉
    2020-11-30 02:14

    I'm not using Git Bash myself, but if this is the same as mentioned in http://tekrat.com/2008/04/30/bash-autocompletion-git-super-lazy-goodness/, you should be able to replace git branch -a with a plain git branch in

    _complete_git() {
      if [ -d .git ]; then
        branches=`git branch -a | cut -c 3-`
        tags=`git tag`
        cur="${COMP_WORDS[COMP_CWORD]}"
        COMPREPLY=( $(compgen -W "${branches} ${tags}" -- ${cur}) )
      fi
    }
    complete -F _complete_git git checkout
    

    (in your .profile or similar) and get what you want.

提交回复
热议问题