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
Post a Comment