Skip to content

Instantly share code, notes, and snippets.

@ryaan-anthony
Last active July 20, 2017 14:42
Show Gist options
  • Save ryaan-anthony/c862a2c22ad8eff7f368c15058c1e04e to your computer and use it in GitHub Desktop.
Save ryaan-anthony/c862a2c22ad8eff7f368c15058c1e04e to your computer and use it in GitHub Desktop.
black=$(tput setaf 0)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
magenta=$(tput setaf 5)
cyan=$(tput setaf 6)
white=$(tput setaf 7)
term_reset=$(tput sgr0)
git_branch() {
git symbolic-ref --short HEAD 2> /dev/null | awk '{print ":"$1}'
}
git_uncommitted() {
git diff-index --quiet HEAD 2> /dev/null -- && echo $green || echo $red
}
export PS1='\[$cyan\]\w\[$(git_uncommitted)\]$(git_branch) \[$term_reset\]\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment