Skip to content

Instantly share code, notes, and snippets.

@jerodsanto
Created June 2, 2010 15:51
Show Gist options
  • Save jerodsanto/422556 to your computer and use it in GitHub Desktop.
Save jerodsanto/422556 to your computer and use it in GitHub Desktop.
# determine current git branch
function parse_git_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "["${ref#refs/heads/}"]"
}
function set_prompt() {
local GREEN='\[\033[0;32m\]'
local WHITE='\[\033[1;37m\]'
local NULL='\[\033k\033\\\]'
PS1="$NULL\u@\h:\w$GREEN\$(parse_git_branch)$WHITE$ "
export PS1
}
set_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment