Reputation: 27351
I've just discovered that my .idea/myproject.iml
file, which is checked in, contains a local path. I therefore need to add it to .gitignore
and make git not track it anymore.
I (and everyone else) would like to keep our local version of .idea/myproject.iml
since it is correct locally.
I was initially considering git rm --cached .idea/myproject.iml
, but that is not a solution since it will delete the file from every other developer. Is this possible in git?
I noticed that tortoise-svn has an "unversion and add to ignore list" command, while tortoise-git has a "delete and add to ignore list", which makes me think that it is not possible...
Upvotes: 1
Views: 85
Reputation: 17455
Since comments are hard to format, let's switch to the answer mode, although it's not really an answer, just an extended advise.
since PyCharm requires the files be located in a folder named .idea in the root of the project.
Indeed. The whole idea is to share (templates of) IDE-related files via a place other than their regular location and .ignore any unintended changes in actual IDE settings.
That is the whole workflow should look like this:
.gitignore
entries.gitignore
The workflow may seem cumbersome, but it looks like you don't have an other option to accomplish the task. On the one hand you don't have a full control over contents of IDE-managed files and can't simply delegate the right to make shareable changes to the IDE (some local stuff can accidently leak as it's happenned already). On the other hand it's really boring and error-prone to force team members to control it manually on every commit.
Perhaps you can create some supporting scripts to merge changes from settings templates to the regular settings. IDEA uses XML files for its settings so the task of merging changes from a template to a file looks pretty doable.
Upvotes: 2