Skip to content

Instantly share code, notes, and snippets.

@smuroff
Created May 9, 2019 12:11
Show Gist options
  • Select an option

  • Save smuroff/f9cc95cb8808c1c638b63780194b77d5 to your computer and use it in GitHub Desktop.

Select an option

Save smuroff/f9cc95cb8808c1c638b63780194b77d5 to your computer and use it in GitHub Desktop.
Bash completion for git commands

Before start make sure where is git-completion script is installed. Usually it's located in following paths:

  • /etc/bash_completion.d/git
  • /usr/share/bash-completion/completions/git

  • Open ~/.bashrc file in text editor (I prefer nano):
$ nano ~/.bashrc
  • Append to file one of these lines (depends on where you've dscovered script):
source /usr/share/bash-completion/completions/git
# or
source /etc/bash_completion.d/git
  • Reload ~/.bashrc (or terminal):
$ source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment