Skip to content

Instantly share code, notes, and snippets.

@danielpereirabp
Created July 13, 2015 17:57
Show Gist options
  • Save danielpereirabp/76aca7f817950692ba64 to your computer and use it in GitHub Desktop.
Save danielpereirabp/76aca7f817950692ba64 to your computer and use it in GitHub Desktop.
Color Git Terminal
function git_branch_name() {
git branch 2>/dev/null | grep -e '^*' | sed -E 's/^\* (.+)$/(\1) /'
}
function show_colored_git_branch_in_prompt() {
PS1="\[\033[38m\]\h:\[\033[032m\]\W\[\033[31m\]\$(git_branch_name)\[\033[m\]$ "
}
show_colored_git_branch_in_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment