Skip to content

Instantly share code, notes, and snippets.

@shamalroy
Created March 27, 2012 18:52
Show Gist options
  • Save shamalroy/ed70ef1662858e9c7b2e to your computer and use it in GitHub Desktop.
Save shamalroy/ed70ef1662858e9c7b2e to your computer and use it in GitHub Desktop.
Showing git branch name on terminal
# From http://railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/
# Add this on bashrc file
# Git branch display with color
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "(ⓖ "${ref#refs/heads/}")"
}
BLUE="\[\033[1;34m\]"
RED="\[\033[0;31m\]"
BLUELIGHT="\[\033[2;34m\]"
PS1="$BLUE\$(date +%H:%M) \w$RED \$(parse_git_branch)$BLUELIGHT\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment