Last active
August 29, 2015 13:56
-
-
Save SamSamskies/8950150 to your computer and use it in GitHub Desktop.
Bash git branch name with colors
This file contains 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
BLACK="\[\033[0;30m\]" | |
RED="\[\033[0;31m\]" | |
GREEN="\[\033[0;32m\]" | |
YELLOW="\[\033[0;33m\]" | |
BLUE="\[\033[0;34m\]" | |
DEFAULT="\[\033[0;00m\]" | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}")" | |
} | |
export PS1="$YELLOW<\u@\h∏> $RED\w$GREEN \$(parse_git_branch)$DEFAULT\$" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment