Git autocomplete

From Dreamwidth Notes
Revision as of 08:29, 22 August 2012 by Swaldman (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If you are using git on a dreamhack, you can set up the bash shell to autocomplete git commands and branch names. This is Very Useful.

First, download the script:

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

Then, set your shell to load this script. Edit the file .bashrc in your home directory,

nano ~/.bashrc

and add this command to the end of it:

source ~/bin/git-completion.sh

From the next time you log in, you should be able to press tab and have git commands and git branch names autocomplete on the command line. Shiny!