Skip to content

Instantly share code, notes, and snippets.

@smathy
Created October 7, 2011 16:25
Show Gist options
  • Save smathy/1270714 to your computer and use it in GitHub Desktop.
Save smathy/1270714 to your computer and use it in GitHub Desktop.
#!/bin/sh
git_exists=`git branch 2>/dev/null | sed -ne'/^\* /s///p'`
if [[ "$git_exists" != "" ]]; then
if [[ "$git_exists" == "(no branch)" ]]; then
git_exists="\e[31m\]$git_exists\e[0m\]"
fi
echo "$git_exists "
elif [ -d .svn ]; then
svn info 2>/dev/null | grep '^URL:' | cut -f2 -d' ' | gsed 's/.*\(trunk\|\(branches\|tags\)\/[^\/]*\).*/\1 /'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment