.gitignore, git add, and files mysteriously disappearing
<p>I have a project, and have shared the root folder through git.  </p>

<p>My compatriots and I are using different versions of Gradle (and have named the project different things), so it would be appropriate for some things in the .idea folder (a certain folder) to be in the .gitignore file. I did not realize this until now, when my friend has pulled it, changed many things due to using a different version, and now pushed it back.</p>

<p>I have added to the .gitignore file:</p>

<pre><code>/.idea/
</code></pre>

<p>However, git seems to still be sending the changes in that folder to the Github repo.</p>

<p>I have checked out a few things, including <a href="https://stackoverflow.com/questions/15774606/git-add-does-add-files-listed-in-gitignore">this</a>, <a href="https://www.jamescoyle.net/how-to/1094-ignoring-files-in-git-with-gitignore" rel="nofollow noreferrer">this</a>, and a few more questions on stack overflow.</p>

<p>I ran <code>git rm --cached .idea/</code> and that successfully kept the changes from being pushed. However, if I checkout another branch and then return to this one, it does not include the appropriate files in the .idea directory.</p>

<p>Thank you,</p>

<p>A confused coder</p>