Skip to content

Instantly share code, notes, and snippets.

@kran
Last active December 21, 2015 06:49
Show Gist options
  • Save kran/6266751 to your computer and use it in GitHub Desktop.
Save kran/6266751 to your computer and use it in GitHub Desktop.
ps1
git-branch-name() {
git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3
}
git-branch-prompt() {
local branch=`git-branch-name`
if [ "$branch" != "" ]; then
printf "[\033[1;33m${branch}\033[0m]"
fi
}
CNONE="\[\033[0m\]"
CG="\[\033[0;32m\]"
CC="\[\033[0;36m\]"
CBR="\[\033[1;41m\]"
UC=$CNONE
UP="\$"
if [ $UID -eq "0" ] ; then
UC=$CBR
UP="#"
fi
export PS1="\[$(tput setaf 1)\]\u@\h:\w \[$(tput sgr0)\]\$(git-branch-prompt)${CNONE} $ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment