Created
March 27, 2012 18:52
-
-
Save shamalroy/ed70ef1662858e9c7b2e to your computer and use it in GitHub Desktop.
Showing git branch name on terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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