All the Git at your fingertips — auto-completion


...want auto-completion for certain git commands?
 
Put this into your ~/.bash_profile  or ~/.bashrc:
_git()
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    opts="checkout commit branch push pull log reset status"
    if [[ ${cur} == * ]] ; then
        COMPREPLY=( $(compgen -W "${opts}"  ${cur}) )
        return 0
    fi
}
complete -F _git git

Comments

Popular posts from this blog

Tuning ext4 for performance with emphasis on SSD usage

NetBeans 6.1: Working with Google´s Android SDK, Groovy and Grails