Cygwin git tab completion Cygwin git tab completion bash bash

Cygwin git tab completion


Updated for 2016: Install package bash-completion.


The answer above prints out bash: have: command not found for nearly every script in bash_completion.d/. This answer from the linked post solves it for me:

if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi

The script/program /etc/bash_completion already includes the scripts in /etc/bash_completion.d and also defines some functions needed by the included scripts.

However, beware that this will slow down the loading of your shell, especially in Cygwin (slowed to about 1 second load for me). To mitigate this, you can rename everything in /etc/bash_completion.d/ to *.bak, and then remove the .bak selectively from the commands you actually care about (thanks to Slow load time of bash in cygwin).

Update: The file /etc/bash_completion magically disappeared (looks like it was due to upgrading the bash-completion package to 2.1-1). As a quick solution, I just created a symlink in /etc to /usr/share/bash-completion/bash_completion.

Update 2: Re-reading the original question, the issue with not having an /etc/bash_completion.d directory might be related to not installing the "bash-completion" package in Cygwin.


In my .bashrc

 for file in /etc/bash_completion.d/* ; do    source "$file" done