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.
2
Answers
‘No’. The
.idea
folder is specific to Jetbrains IDEA applications (Intellij, Webstorm, etc..) and is used to configure your IDE per your workstation environment or shared developer settings.That being said, you do have options:
.gitignore
file. That will stop git (and IDEA) from monitoring or caring about changes..gitignore
you can use heregit
will still see those file changes. You would definitely want to add.idea
to your.gitignore
then, as other developers won’t have the same folder structure and the symlink will ‘break’ for them.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).Anyway, the overall idea is as follows:
In your IDE, create a new project where you want to keep your
.idea
— lets assume this will beC:JetBrainsProjectsStoreMyProject
.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:JetBrainsProjectsStoreMyProject
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:ProjectsMyActualProject
.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:JetBrainsProjectsStoreMyProject.idea
while the actual code files are inC:ProjectsMyActualProject
.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:JetBrainsProjectsStoreMyProject
.There is a ticket that asks for the same: https://youtrack.jetbrains.com/issue/IDEA-1701022. Watch it (star/vote/comment) to get notified with any progress.