title: Unstage a deleted file in git
body: <p>Usually, to discard changes to a file you would do:</p>
  
  <pre><code>git checkout -- &lt;file&gt;
  </code></pre>
  
  <p>What if the change I want to discard is deleting the file? The above line would give an error:</p>
  
  <pre><code>error: pathspec '&lt;file&gt;' did not match any file(s) known to git.
  </code></pre>
  
  <p>What command will restore that single file without undoing other changes?</p>
  
  <p><strong>bonus point:</strong> Also, what if the change I want to discard is <em>adding</em> a file? I would like to know how to unstage that change as well.</p>