title: Conditional space in PS1
body: <p>I'm basically trying to create a PS1 that has this output:</p>
  
  <pre><code>$ ~/Projects/Blah (master):
  </code></pre>
  
  <p>However, if the folder I'm in is not a Git repository, I want it to look like this instead:</p>
  
  <pre><code>$ ~/Projects/Blah:
  </code></pre>
  
  <p>This is my current PS1:</p>
  
  <pre><code>export PS1="$ \w \$(__git_ps1): "
  </code></pre>
  
  <p>It gives me the output I want for when I'm in a Git repo, but when I'm in a folder that is not in a Git repo, the output looks like this:</p>
  
  <pre><code>$ ~/Projects/Blah :
  </code></pre>
  
  <p>I don't really want that space there if it isn't a Git repo. </p>
  
  <p>Is there some way I can specify this in my PS1?</p>