Skip to content

Instantly share code, notes, and snippets.

@EnriqueVidal
Forked from smathy/.bash_profile
Created February 15, 2011 06:58
Show Gist options
  • Save EnriqueVidal/827198 to your computer and use it in GitHub Desktop.
Save EnriqueVidal/827198 to your computer and use it in GitHub Desktop.
PROMPT_COMMAND=$PROMPT_COMMAND${PROMPT_COMMAND:+;}'PS1="\[\e[01m\]\t\[\e[0m\] \[\e[1;32m\]`~/bin/branch.sh`\[\e[0m\]\[\e[1;35m\]`~/bin/stash.sh`\[\e[0m\]\[\e[33m\]\w \[\e[0m\]\[\e[1m\]\$\[\e[0m\] "'
#!/bin/sh
# ~/bin/branch.sh
# NOTE: you'll need `gsed` - ie. GNU sed for the svn one to work
git_exists=`git branch 2>/dev/null | grep '^*' | cut -f2- -d' '`
if [[ "$git_exists" != "" ]]; then
echo "$git_exists "
elif [ -d .svn ]; then
svn info 2>/dev/null | grep '^URL:' | cut -f2 -d' ' | gsed 's/.*\(trunk\|\(branches\|tags\)\/[^\/]*\).*/\1 /'
fi
#!/bin/sh
# ~/bin/stash.sh
git_exists=`git stash list 2>/dev/null | wc -l | sed 's/ *//g'`
if [[ "$git_exists" != "" && $git_exists > 0 ]]; then
echo "[$git_exists] "
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment