title: Git: Discard all changes to a single file since a certain commit
body: <p>I want to "undo" all local changes to one specific file, i.e. return to this file's state at origin/master:</p>
  
  <ul>
  <li>if it existed and was modified => revert to old version.</li>
  <li>if it was added => delete file.</li>
  <li>if it was removed => re-add file.</li>
  <li>if it was renamed => rename back to old name.</li>
  <li>etc.</li>
  </ul>
  
  <p><code>git checkout origin/master -- path/to/file.txt</code> works for modified files but fails notably for files that were added and thus did not exist at origin/master ("No such file or directory").</p>
  
  <p>If need be I can rely on commits only ever changing one file. (Then perhaps I could parse the SHAs from <code>git log --follow --oneline --decorate origin/master.. path/to/file.txt</code> and then revert (or rebase/drop) those commits. But this seems manual and hacky and I'd prefer a more declarative solution...)</p>
  
  <p>UPDATE: To clarify, the local changes have been committed. There may be multiple commits with changes to the file.</p>