ozbillwang
11/17/2014 - 2:48 AM

Put Your Git Branch in Your Bash Prompt with color

Put Your Git Branch in Your Bash Prompt with color

http://code-worrier.com/blog/git-branch-in-bash-prompt/

https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh

 curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.sh

Did some adjusts, here is mine. (running in iTerm under Mac os)

source ~/.git-prompt.sh
export PS1="\[\033[1;34m\]\!\[\033[0m\] \[\033[1;35m\]\u\[\033[0m\]:\[\033[1;35m\]\w\[\033[1;33m\] \$(__git_ps1)\[\033[0m\] \n$ "