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

Eclipse sucks, so use NetBeans!

Tuning ext4 for performance with emphasis on SSD usage

Tuning ext3 for performance without losing its data integrity potential