title: Git remove a file from a branch, keep it in the master
body: <p>I create a new branch</p>
  
  <pre><code>git checkout -b mybranch
  </code></pre>
  
  <p>then I delete a file from it</p>
  
  <pre><code>git rm --cached myfile.txt
  </code></pre>
  
  <p>but I want to keep it in the master; why when I checkout to the master</p>
  
  <pre><code>git checkout master
  </code></pre>
  
  <p>I get an "error: The following untracked working tree files would be overwritten by checkout: file.txt" and if I force the checkout</p>
  
  <pre><code>git checkout master -f
  </code></pre>
  
  <p>the file is deleted from the file system?</p>
  
  <p>I am sure I am missing something, but I just wanted to remove the file from a branch and not from the master while it seems that git wants to merge the branch when I checkout master.</p>
  
  <p>The reason why I used <code>git rm</code>  and not <code>gitignore</code> was that the file was already been committed.</p>