Reputation: 31
I have a project, and have shared the root folder through git.
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.
I have added to the .gitignore file:
/.idea/
However, git seems to still be sending the changes in that folder to the Github repo.
I have checked out a few things, including this, this, and a few more questions on stack overflow.
I ran git rm --cached .idea/
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.
Thank you,
A confused coder
Upvotes: 3
Views: 991
Reputation: 37990
Files that are already tracked in the repository will remain so even if you add them to .gitignore
- it only affects untracked files. In order to remove a file from git without deleting the file from the working directory, use
git update-index --force-remove yourFileName
This will mark the file for removal without deleting it. --force-remove
seems to only work on individual files, so in order to remove an entire folder, try this:
find .idea | xargs git update-index --force-remove
Upvotes: 1