configuring git completion on mac osx

  1. PS1=’[\u@\h \w$(__git_ps1 ” (%s)”)]\$ ‘PS1=’[\u@\h \w$(__git_ps1 ” (%s)”)]\$ ‘PS1=’[\u@\h \w$(__git_ps1 ” (%s)”)]\$download/checkout git-completion.bash from to ur favourite directory 
    1. I downloaded mine to ~/bin
  2. include them in .bashrc/.bash_profile
    1. I added the following line in .bash_profile 

      source ~/bin/git-completion.bash
      source ~/bin/

    2. opt: you could also do a file exists check before doing the include
  3. change you prompt to include __git_ps1 variable
    1. for ex: after the above source lines do PS1=’[\u@\h \w$(__git_ps1 ” (%s)”)]\$
  4. after you restart the terminal/run bashrc again, you will see the branch information when you are at a git will also be able to tab-complete git commands

optionally you can color your prompt by following the instructions at