Skip to content

Instantly share code, notes, and snippets.

@jamesmoriarty
Created March 5, 2012 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmoriarty/1975916 to your computer and use it in GitHub Desktop.
Save jamesmoriarty/1975916 to your computer and use it in GitHub Desktop.
git branch name in prompt
##
# Bash customizations
##
export CLICOLOR=1 # Enable color shell
export LSCOLORS=ExFxCxDxBxegedabagacad # Define colors
export COLOR_RED="\e[0;31m"
export COLOR_PINK="\e[35;1m"
export COLOR_NORMAL="\e[m"
__git_ps1 ()
{
local b="$(git symbolic-ref HEAD 2>/dev/null)";
if [ -n "$b" ]; then
printf " (%s)" "${b##refs/heads/}";
fi
}
export PS1="$COLOR_PINK\u$COLOR_NORMAL \w$COLOR_RED\$(__git_ps1 ' (%s)')$COLOR_NORMAL \$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment