title: git checkout branch -- file vs git merge
body: <p>I am concerned that git checkout other_branch -- file will overwrite the file in my current branch and not do a merge at all.</p>
  
  <p>Say I am on a branch called foo. I want to merge a file in foo called bar.js, with the same filepath on a branch called baz;</p>
  
  <p>so <code>git branch -v</code> looks like:</p>
  
  <pre><code>* foo        adbe2d4 pdev:set
    baz        ae598f5 [ahead 5] sync-msg
  </code></pre>
  
  <p>The way I know how to do this is to do:</p>
  
  <pre><code>git checkout baz -- bar.js
  </code></pre>
  
  <p>what I am confused about, is, doesn't this overwrite the file on my branch with the same name?</p>
  
  <p>How can I merge bar.js from baz instead of checking out the file and overwriting the work on the foo branch? Or am I mistaken and a merge does indeed happen? </p>