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

Java 8: Default Interface Implementations, The Diamond Problem, Multiple Inheritance, and Precedence

Tuning ext3 for performance without losing its data integrity potential