Enterprise Framework

Software Solutions in the Enterprise

Mac Sierra : Git Completion and Bash Prompt With Branch Update

The following will help get GIT completion setup locally on Mac Sierra.  Not correctly loading the git-completion.bash or git-prompt.sh can result in getting the following error: 


ERROR:   __git_ps1: command not found


Check that you did not mistype the file name as that could result in the script not being found and ran.


STEPS:

$ cd ~/Downloads       

$ curl -OL https://github.com/git/git/raw/master/contrib/completion/git-completion.bash

$ mv git-completion.bash ~/.git-completion.bash

$ sudo nano ~/.bashrc

ADD .bashrc CONTENTS
===============================
 
if [ -f ~/.git-completion.bash ]; then
    source ~/.git-completion.bash
fi
 


$ cd ~/Downloads/

$ curl -OL https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
 
$ mv ~/Downloads/git-prompt.sh ~/.git-prompt.sh

 
UPDATE .bash_profile CONTENTS
===============================
 
if [ -f ~/.git-prompt.sh ]; then
    source ~/.git-prompt.sh
fi
 
export PS1='\h:\u \W$(__git_ps1 "(%s)") $ '

Comments are closed