Add git name branch to prompt on MacOS

Posted on

To get the command line tools installed, you may need to
$ xcode-select --install

Then add this to your .bash_profile

GIT_PS1_SHOWUPSTREAM="auto"
GIT_PS1_SHOWCOLORHINTS="yes"
. /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash
. /Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh
#PROMPT_COMMAND="parse_vcs_branch2; $PROMPT_COMMAND"
PROMPT_COMMAND='__git_ps1 "$(networksetup -getcomputername):[w]" "\$ ";'
PS1='__git_ps1 "h:[w]" "\$ ";'

Leave a Reply

Your email address will not be published.