title: failed to add a file to gitignore
body: <p>I have a file I have to be ignored by git 
  I have done this actions</p>
  
  <ol>
  <li>git rm --cached <code>path_to_file/filename.py</code></li>
  <li>added <code>path_to_file/filename.py</code> to .gitignore</li>
  </ol>
  
  <p>The file does not show up on git indeed but when I switch branches or even switch back to the original branch, the file is gone. </p>