Skip to content

Install Bash git completion

carlsverre edited this page May 2, 2011 · 17 revisions

git-flow completion requires git-completion to work. How exactly you go about installing git-completion varies wildly from system to system, so it's hard to give exact installation instructions.

OS X

By far the easiest way to install both Git and git-completion is via Homebrew, so you should pick that one.

Homebrew

  1. Install homebrew

  2. Install Git and bash-completion: brew install git bash-completion

  3. Add bash-completion to your .bash_profile:

     if [ -f `brew --prefix`/etc/bash_completion ]; then
       . `brew --prefix`/etc/bash_completion
     fi
    

MacPorts

If you installed Git via MacPorts, you prob'ly need to do something like this:

cp /opt/local/etc/bash_completion.d/git ~/.git-bash-completion.sh
echo "[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh" >> ~/.profile
. ~/.profile

Ubuntu

  1. Install Git and bash-completion: sudo apt-get install git bash-completion
  2. I don't think you need to do anything else.
Clone this wiki locally