Open your .bash_profile or .bashrc file by doing the following:
cd subl .bash_profile
subl $HOME/.bashrc
Add this either in your .bash_profile or .bashrc file:
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ ()/'
}
export PS1="\[$(tput bold;tput setaf 6)\]\W\[33[32m\]\$(parse_git_branch)\[33[00m\] \[$(tput bold;tput setaf 6)\]➜ \[$(tput sgr0;tput setaf 7;tput setaf 3)\] "
You can just play around with it by doing the following:
echo $PS1
(This will show you how your stuff is formated.)
export PS1="[\u]: (\W) >> "
export PS1="\e[0;36m [\u] (\W) >> \e[m "
(This will temporarily change your settings until you open up your terminal again.)
Sources:
- http://stackoverflow.com/questions/17811327/git-branch-name-in-prompt
- http://shapecatcher.com/