Skip to content

Instantly share code, notes, and snippets.

@dbi
Created September 6, 2012 14:03
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 dbi/3656582 to your computer and use it in GitHub Desktop.
Save dbi/3656582 to your computer and use it in GitHub Desktop.
Hitch description in your prompt
function branch {
ref=$(git symbolic-ref HEAD 2> /dev/null)
if [ $? -eq 0 ]; then
echo " "${ref#refs/heads/}""
fi
}
function hitch_pair {
source ~/.hitch_export_authors
if [ `git symbolic-ref HEAD 2> /dev/null` ] \
&& [ -n "${GIT_AUTHOR_EMAIL:+1}" ]; then
echo $GIT_AUTHOR_EMAIL|awk -F "[+@]" '{ print " "$2"+"$3 }'
fi
}
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
CYAN="\[\033[0;36m\]"
NO_COLOUR="\[\033[0m\]"
export PS1="$YELLOW\w$GREEN \$(branch)$CYAN\$(hitch_pair)$NO_COLOUR$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment