Skip to content

Instantly share code, notes, and snippets.

@MightyPork
Created September 12, 2015 10:56
Show Gist options
  • Select an option

  • Save MightyPork/c73648e9324c7a8e11b0 to your computer and use it in GitHub Desktop.

Select an option

Save MightyPork/c73648e9324c7a8e11b0 to your computer and use it in GitHub Desktop.
source .bash_colors
export PROMPT_DIRTRIM=2
function _branch_ps1 {
_branch=""
if [ -d .git ]; then
_br=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD)
if [ $_br == "master" ]; then
_branch="${BIRed}$_br${Reset} "
elif [ $_br == "testing" ]; then
_branch="${BGreen}$_br${Reset} "
else
_branch="${BCyan}$_br${Reset} "
fi
fi
export PS1="$_branch${BBlue}\w \\$ ${Reset}"
}
export PROMPT_COMMAND=_branch_ps1
# init prompt
_branch_ps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment