Git auto-completion for the bash shell

You can enable auto-completion for Git commands in the bash shell. For this copy the following file to your home directory under the name “.git-completion.bash”.

git-completion.bash in the main Git repository.

Afterwards add the following lines to your .bashrc file and restart the bash.

if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash

Now you have code completion, e.g. if you type git c and press tag you see the possible values.

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Lars Vogel, Other and tagged . Bookmark the permalink.

4 Responses to Git auto-completion for the bash shell

Comments are closed.