Skip to content

Instantly share code, notes, and snippets.

@mandiwise
Created February 19, 2016 19:44
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 mandiwise/8112fb0668f4801cc3f9 to your computer and use it in GitHub Desktop.
Save mandiwise/8112fb0668f4801cc3f9 to your computer and use it in GitHub Desktop.
Customize bash prompt with highlighted git branch
txtcyn=$'\e[0;36m' # Cyan
txtred=$'\e[0;31m' # Red
txtwht=$'\e[0;37m' # White
txtrst=$'\e[0m' # Text Reset
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[$txtcyn\]\$(parse_git_branch) \[$txtrst\]\$ " # fancify Terminal prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment