設定に必要なファイルをまずダウンロードする。
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
もしかしたらLinuxだとcurlコマンドが入ってない場合があるのでインストールする。
# Debian使用 sudo apt install curl
.bashrc
に以下を追記。
echo "source ~/.git-completion.bash" >> ~/.bashrc
.bashrc
を再読み込み。
source ~/.bashrc
これでGitコマンドのオプションやブランチ名などもタブを押せば補完できる。