title: Add git remote only if it doesn't exist
body: <p>Is there a easy way for a script to detect if a remote already exists and add it only if it doesn't? A plumbing command or porcelain flag?</p>
  
  <p>When running <code>git remote add foo https://example.net</code> with an existing remote I get:</p>
  
  <pre><code>fatal: remote foo already exists.
  </code></pre>
  
  <p>Ideally there would be a flag such as <code>--if-not-exists</code> or <code>--update-if-exists</code> but I couldn't find any in the <a href="https://git-scm.com/docs/git-remote" rel="noreferrer">documentation</a>.</p>
  
  <p>I'm thinking of grepping the output of <code>git remote</code> but is there a better way?</p>