How can I set up autocompletion for Git commands? How can I set up autocompletion for Git commands? bash bash

How can I set up autocompletion for Git commands?


You need to source /etc/bash_completion.d/git to enable git auto-completion.

In my .bashrc it's done with:

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


Put the following lines in your ~/.bashrc

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

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.


You need to install this package if missing. And then logout and login.

apt-get install bash-completion