title: Remove file from repository under git
body: <p>I want to remove several files from git repository. My repository has several branches and I do following:</p>
  
  <pre><code>git rm --cached filename 
  git commit -am "deleted filename"
  git checkout anotherbranch
  </code></pre>
  
  <p>I am getting:</p>
  
  <pre><code>error: The following untracked working tree files would be overwritten 
  by checkout:
      output/filename
  
  Please move or remove them before you can switch branches.
  Aborting
  </code></pre>
  
  <p>So question is how to remove the file (accidentally added) from repo? I do NOT want to track the filename by git I plan to add this filename to .gitignore.</p>
  
  <p>Best regards,</p>
  
  <p>Peter</p>