Latest Tweets:
Open and edit your Bash profile by launching a Terminal and executing
$ sudo nano ~/.bash_profile
Include these constants in your bash profile, so we have better semantics:
BASH_NEWLINE="\n"
BASH_GRAY="\[\e[1;30m\]"
BASH_LIGHT_GREEN="\[\e[1;32m\]"
BASH_WHITE="\[\e[1;0m\]"
BASH_LIGHT_GRAY="\[\e[0;37m\]"
Insert this function (you decide its name):
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "("${ref#refs/heads/}") ";
}
And modify your PS1 variable like this:
PS1="${BASH_NEWLINE}$(date +%H:%M:%S) \u at \h \w \$(parse_git_branch)${BASH_WHITE}$";
Voila. Press ^X (Control-X) to exit, answer YES to save, and relaunch Terminal.app. Now you always know which branch you’re on.

ev