Bash – Git auto-complete

autocompletebashcommandcommand linegit

I am using Git as many of you do. Also, I don't use any GUI for that — just CLI. So I was wondering: are there any way to make Git commands (git status, git checkout etc.) complete themselves when hitting Tab? Like other CLI commands do.

P.S. I'm using Arch Linux, if that anyhow matters.

Best Answer

Add source /usr/share/git/completion/git-completion.bash to your ~/.bashrc.

References

  1. Arch Linux Wiki