In our project there is .idea
folder checked-in into git repository with old content
(there is even .iml file that is actually previous generation),
and it puts project into dirty state right after import.
While ultimate solution will be to remove .idea
folder completely,
is there a way to configure alternative location for IDE .idea
folder,
so that when I work on the project current .idea
folder is not used and not modified.
is there a way to configure alternative location for IDE
.idea
folder, so that when I work on the project current.idea
folder is not used and not modified?
Yes, you can keep your .idea
elsewhere.
Please note:
I will be using PhpStorm as an IDE (JetBrains IDE I'm using). It has simple project config (where the project consists of a single module of WEB_MODULE
type; the same applies to WebStorm) while Java/Python/Ruby one have more complicated project settings (where it's normal (especially for Java world) to have multiple modules per project).
I'm not sure how easy it is to change this for existing project (it's not a problem for a new project). Might be possible to do manually by editing the config files directly, but cannot guarantee that it will not have some side effects (especially if it's multi-module one, while the IDE is closed of course).
So it's much better to go with a new project and configure it from scratch (most of the config files can be copied over from old .idea
into the new one).
In your IDE, create a new project where you want to keep your .idea
-- lets assume this will be C:\JetBrainsProjectsStore\MyProject
.
Go to the project settings and find a place where you configure your Content Roots. In PhpStorm/WebStorm this will be Settings/Preferences | Directories
.
Remove existing Content Root (by default every project has one). In our example this will be the aforementioned C:\JetBrainsProjectsStore\MyProject
folder.
Add a New Content Root instead: point it to the folder where your project files actually are (or where you want to keep them). Lets assume this will be C:\Projects\MyActualProject
.
Save. That's it (well, repeat steps 3-4 for other modules if your project has them).
Now your project config is stored in C:\JetBrainsProjectsStore\MyProject\.idea
while the actual code files are in C:\Projects\MyActualProject
.
Obviously, if you now need to use Open
in the IDE to open a project or open it from the command line, you need to use the parent folder where the actual .idea
is -- C:\JetBrainsProjectsStore\MyProject
.
There is a ticket that asks for the same: https://youtrack.jetbrains.com/issue/IDEA-170102. Watch it (star/vote/comment) to get notified with any progress.