Created
          October 7, 2011 16:25 
        
      - 
      
- 
        Save smathy/1270714 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/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