Enable Git autocompletion

I just discovered a useful script that enables autocompletion in git (using the Tab key).

As per this question’s best answer, the steps to enable the autocompletion in git are the following:

  1. Download the script from this url. You can do this on Gadi by running:
    curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

  2. Source the downloaded script with:
    . ~/.git-completion.bash
    You can also put the above line in your ~/.bashrc file, so it will get sourced every time you login to Gadi.

  3. Done! Now you can trigger autocompletion in git commands by clicking on the Tab key (works also for branches!!).

Cheers
Davide

2 Likes