title: Difference between git checkout HEAD -- filename and git checkout -- filename
body: <p>Let's begin with a situation.</p>
  
  <ol>
  <li>I stash some changes (5 files) <code>git stash</code></li>
  <li>Change some files</li>
  <li>Commit the changes <code>git commit -m "Commit message"</code></li>
  <li>Get the changes back from stash <code>git stash apply</code></li>
  </ol>
  
  <p>I receive a merge-conflict in 2 files because of the commit. I no longer want the changes in those 2 files So I tried to revert those changes.</p>
  
  <p>I did <code>git checkout -- background.js</code></p>
  
  <p>It failed with error </p>
  
  <blockquote>
    <p>error: path 'src/background/background.js' is unmerged</p>
  </blockquote>
  
  <p>But then I read <a href="https://stackoverflow.com/a/7147320/1310070">this SO post</a> and tried</p>
  
  <pre><code>git checkout HEAD -- background.js
  </code></pre>
  
  <p>It works successfully. It happened with me for both the files. I want to understand the difference bewteen</p>
  
  <p><code>git checkout -- file</code> AND <code>git checkout HEAD -- file</code></p>