Git tab autocomplete

The following adds autocomplete to your git repos - branches when checking out and other git commands.

Download this bash file and save somewhere handy (/root or similar).

One way of getting it straight onto your server is using wget

wget https://raw.github.com/git/git/master/contrib/completion/git-completion.bash

Then edit your ~/.bash_profile and put the following code in:

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

Logout, log back in - you should now be able to type git che[tab] for it to autocomplete to git checkout. Also works with branches and other git commands.

View this post on Github

You might also enjoy…

Mike Street

Written by Mike Street

Mike is a CTO and Lead Developer from Brighton, UK. He spends his time writing, cycling and coding. You can find Mike on Mastodon.