Skip to content

Instantly share code, notes, and snippets.

@nebhale
Created September 9, 2013 01:03
Show Gist options
  • Save nebhale/6490149 to your computer and use it in GitHub Desktop.
Save nebhale/6490149 to your computer and use it in GitHub Desktop.
A bash function and prompt to get the current git branch status in a prompt.
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
# Set titles
PS1='\[\e]2;\w\]\[\a\][\[\e[0;32m\]\h\[\e[0;33m\]$(parse_git_branch)\[\e[0m\]]: '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment