How to clone project and keep its settings separate from original project?

I cloned my project, that is I checked out a different git branch of the project to a different folder and copied over the .idea folder to have the same PHPStorm settings in the clone. I just need to have different branches of the same project independently in two folders, which I achieved successfully with the git worktree feature.

Now the problem is that certain (if not most of the) project settings are shared between the projects like the list of opened files, theme, PHP version and many other settings. When I open/close a file and switch to the other project the same files are open there. If I change a settings in one project, close it and switch to the other project, the same setting is applied there. How can I separate the settings from each other?

I did some search on the topic and the advice was to delete workspace.xml in the .idea folder. I did that and it helped for a while but now the problem came back. Maybe I shouldn't have copied all files .idea, if so then which ones? I keep the whole .idea folder in .gitignore so it's certainly not shared via git.

Comment actions Permalink

Hi there,

The IDE workspace of the project is stored in two places:

  1. General / non machine-specific settings -- stored in PROJECT_ROOT/.idea subfolder
  2. Machine-specific part -- stored in a separate folder where the IDE-wide settings are.

The general project settings file (.idea/workspace.xml) has the Project ID inside it. E.g.

<component name="ProjectId" id="1OVsD6SX2AzSazagHBXOTEBLIaW" />

On Windows, the other (machine-specific) settings are stored in C:\Users\USERNAME\AppData\Roaming\JetBrains\PhpStorm2021.3\workspace folder, in a PROJECT_ID.xml file (e.g. 1OVsD6SX2AzSazagHBXOTEBLIaW.xml)


When you have copied the workspace.xml file together with other files in the .idea folder, it keeps using the same ID that points to the same 2nd file. That's why you see the same open files in both projects.


Just delete that line (while the project is closed in the IDE or even better when the IDE is closed) and PhpStorm will make a new ID the next time you open that project. NOTE: if you share workspace.xml via VCS, it may still be getting the old ID from there when you pull the changes from VCS.

Comment actions Permalink

Thanks, this worked perfectly! I think I might have forgotten that I had deleted workspace.xml in yet another project so this particular project still had the file with the same ID in both copies. I should have deleted it in this project, too. But now I know why this is happening and just recreating the ID has a similar effect.


Please sign in to leave a comment.