show git branch in prompt/terminal
found here: http://www.jonmaddox.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
I made small modifications to fit my liking:
function parse_git_branch {
git branch –no-color 2> /dev/null | sed -e ‘/^[^*]/d’ -e ‘s/* \(.*\)/(\1)/’
}
function proml {
local BLUE=”\[\033[0;34m\]”
local RED=”\[\033[0;31m\]”
local LIGHT_RED=”\[\033[1;31m\]”
local GREEN=”\[\033[0;32m\]”
local LIGHT_GREEN=”\[\033[1;32m\]”
local WHITE=”\[\033[1;37m\]”
local LIGHT_GRAY=”\[\033[0;37m\]”
case $TERM in
xterm*)
TITLEBAR=’\[\033]0;\u@\h:\w\007\]’
;;
*)
TITLEBAR=”"
;;
esac
PS1=”${TITLEBAR}\
$RED\u@\h:\w$GREEN\$(parse_git_branch)\
$LIGHT_GRAY\$ ”
PS2=’> ‘
PS4=’+ ‘
}
proml
Categories news | Tags:
Social Networks: Facebook, Twitter, Google Bookmarks, del.icio.us, StumbleUpon, Digg, Reddit.
You can follow any follow up comments to this entry through the RSS 2.0 feed.


Leave a Reply
By submitting a comment here you grant imjeee | Jie Lian blog a perpetual license to reproduce your words and name/web site in attribution. Inappropriate or irrelevant comments will be removed at an admin's discretion.