Skip to content

Instantly share code, notes, and snippets.

@taf2
Created October 2, 2019 13:18
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 taf2/9dfbf35fb16885fa65db50734e2b735a to your computer and use it in GitHub Desktop.
Save taf2/9dfbf35fb16885fa65db50734e2b735a to your computer and use it in GitHub Desktop.
parse_git_branch() {
branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'`
if [ "${branch}x" != "x" ]; then
echo -n "$branch"
if [ `git st | grep -c 'Changes'` -ge 1 ] ; then echo -n ' * ' ; fi
fi
}
export PS1="\h\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\]> "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment