Disable auto-completion of remote branches in Git Bash?

后端 未结 9 1508
广开言路
广开言路 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:12

    FWW here is a hack to __git_complete_refs that does the trick

    __git_complete_refs ()
    

    { local remote track pfx cur_="$cur" sfx=" "

    while test $# != 0; do
        case "$1" in
        --remote=*) remote="${1##--remote=}" ;;
        --track)    track="yes" ;;
        --pfx=*)    pfx="${1##--pfx=}" ;;
        --cur=*)    cur_="${1##--cur=}" ;;
        --sfx=*)    sfx="${1##--sfx=}" ;;
        *)      return 1 ;;
        esac
        shift
    done
    echo cur_ $cur_ > a
     if [[  $GIT_COMPLETION_CHECKOUT_NO_GUESS != 1 || $cur_ == "origin"* ]]; then
        __gitcomp_direct "$(__git_refs "$remote" "$track" "$pfx" "$cur_" "$sfx")"
      else
        __gitcomp_direct "$(__git_heads  "" "$cur_")"
      fi
    

    }

提交回复
热议问题