Pages

Sunday, April 1, 2018

Tab completion for GIT client application on MAC OS

Most of you have noticed when you install GIT client to MAC OS, it won't workd tab completion by default. It will be more annoying when you moving from Linux to MAC as a new user and highly unefficient. You have to perform few more steps to aquire those comforting option.

For this you need to follow below steps:
  1. Install Homebrew if not already installed.
  2. Install Git and bash-completion: brew install bash-completion
  3. Add bash-completion to your ~/.bash_profile
if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi


If you follow above steps as in [1] most probably it won't work. If it didn't work follow below steps:

Download following files to BREW_PREFIX/etc/bash_completion.d/ directory (Find BREW_PREFIX by brew --prefix command)
 And then add following to the ~/.bash_profile and source it. 

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi
if [ -f $(brew --prefix)/etc/bash_completion.d/git-completion.bash ]; then
  . $(brew --prefix)/etc/bash_completion.d/git-completion.bash
fi
if [ -f `brew --prefix`/etc/bash_completion.d/git-flow-completion.bash ]; then
  . `brew --prefix`/etc/bash_completion.d/git-flow-completion.bash
fi


[1] https://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion  
[2] https://github.com/bobthecow/git-flow-completion/issues/46