Skip to content

Instantly share code, notes, and snippets.

@dryman
Created March 23, 2011 13:20
Show Gist options
  • Save dryman/883076 to your computer and use it in GitHub Desktop.
Save dryman/883076 to your computer and use it in GitHub Desktop.
git on prompt
function git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "("${ref#refs/heads/}") ";
}
export PS1="\[\033[1;32m\]\w\[\033[0m \[\033[0m\]\[\033[1;34m\]\$(git_branch)\[\033[0m\]$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment