10/24/2014 - 8:57 PM

git branch to bash prompt

git branch to bash prompt

Add Git Branch in Your Bash Prompt

download the script and save it to your root directory:

curl -o ~/

Add the following to your ~/.bash-profile

# Load in the git branch prompt script.
source ~/

Now add \$(__git_ps1) to your prompt declaration (line that starts with PS1).

My declaration looks like this:

**example with colors: **

PS1="\[$BLUE\]\u\[$YELLOW\]\[$YELLOW\]\w\[\033[m\]\[$MAGENTA\]\$(__git_ps1)\[$WHITE\]\$ "