Skip to content

Instantly share code, notes, and snippets.

@EskiMag EskiMag/gist:627863
Created Oct 15, 2010

Embed
What would you like to do?
Show git branch name in bash prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function proml {
local WHITE="\[\033[40;1;37m\]"
local LIGHT_GRAY="\[\033[47;1;30m\]"
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="${TITLEBAR}\
\w $LIGHT_GRAY\$(parse_git_branch)\
$WHITE\$ "
PS2='> '
PS4='+ '
}
proml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.