is there a bash-completion script that supports filename completion? I use mostly mercurial and there I can type:
hg diff test/test_
This solves the git diff problem for me, put the following in .bashrc:
alias gid='git diff'
__gdiff () {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(git status --porcelain | grep '^.[^ ?]' | cut -b 4-)
case "${prev}" in
gid)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
}
complete -F __gdiff gid
And then do gid instead of git diff . It may be simplified, but seems to work well as a quick fix.