Git autocomplete

From Dreamwidth Notes
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!