title: How do I get my iTerm prompt to display differently when I'm in a Git branch?
body: <p>I'm trying to get my iTerm prompt set up the same way as <a href="http://www.youtube.com/watch?v=OXpCB3U_4Ig&amp;t=10m39s" rel="noreferrer">Paul Irish</a></p>
  
  <p>So far I have the following in <code>~/.profile</code>:</p>
  
  <pre><code># Add git branch name to prompt
  parse_git_branch() {
    git branch 2&gt; /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/ on \1/'
  }
  
  PS1='\n\[\033[0:35m\]\u\[\033[0;32m\]\w\[033[0m\]$(parse_git_branch)\n\$\[\033[0m\] '
  </code></pre>
  
  <p>I don't know how to make just the branch appear in a different colour and not the preceding "on"</p>
  
  <p>As well as this there are other features such as:</p>
  
  <ul>
  <li>Displaying an "o" at the prompt when not in a git branch</li>
  <li>Displaying a "±" when in a branch</li>
  <li>Displaying the date at the end of the line</li>
  </ul>
  
  <p>Any help would be appreciated</p>