Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.