问题
My google search give me this thread which leads us to Pycharm official site here saying that we should KEEP all except workspace.xml
, tasks.xml
Though I see that files misc.xml
and <projectFolderName>.iml
also contains local/physical path pointing to a sub folder in my user home in Ubuntu.
So I confused and brought it up here - should we git ignore those two files too?
回答1:
1) <projectFolderName>.iml
- By default Idea editors produce <projectFolderName>.iml
files which are place specific. To deal with it:
Rename a project:
Now you have two files in .idea dir: .name
and YOUR_RENAMED_PROJECT.iml
both of them are directory and platform independent and could be added to git.
2) misc.xml - TL;DR; ignore it
For PyCharm misc.xml may contain platform specific paths and even could ship more sensitive data.
3) Finally one has to rename a toolchain and use the same name across the team:
The best way to share your project files among a group of developers is to rename your project interpreter into something not dependent on your file system paths (e.g. "Python 2.7" or "My Project: Python 2.7 virtualenv") and then use that name consistently for all the developers.
You can rename your interpreters in "File | Settings | Project | Project Interpreter | | More... | Edit".
Source from PyCharm tracker
回答2:
You need to use your own judgment based on circumstances.
misc.xml contains local environment specific information, for example project interpreter name, like this
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (myvirtenvname)" project-jdk-type="Python SDK" />
Unless there is a strict shared virtual environments naming policy in the team, I would recommend ignoring it. I myself prefer no-one dictating me how I name my virtual environments on my dev machine. I might have many other projects and potential conflicting names.
The .iml and .name are addressed by the other answer. I do not like the fact though that the project interpreter name is here also bundled with all the project settings in the projecname.iml xml file. I wish it was more granular and in a separate file in the .idea folder so I can decide to share it or not. It is environment dependent and what interpreter to use might be better left to be decided by the individual. If jetbrains are reading this please consider.
来源:https://stackoverflow.com/questions/38590022/should-we-ignore-misc-xml-and-projectfoldername-iml-in-pycharm-idea-folder