Sometimes after Git merge the project files are "yellowed out"

已回答

This happens now and then and drives me crazy: Sometimes after doing a git merge from another branch, the project files are "lost", meaning getting the yellow background and the Directories folder in settings are empty.

I'm unable to add my project files again, unless I delete the whole .idea folder and restart PHPStorm. This works, but all my project settings are lost.

What to do??

3

Hi there,

Yes, recreating .idea folder that way is the way to fix it (if you have no backups). The project config gets broken for whatever reason.

Make a back up of the .idea folder before deleting (the broken one). Then, when it happens the next time and project is recreated and reconfigured -- do a comparison. In particular compare *.iml files (less likely to be an issue) + modules.xml (more likely).

 

P.S. Perhaps you have .idea under the version control? And when you do the merge it overwrites the existing stuff...

The yellow background in the Project View panel clearly suggests that the IDE treats those files as "outside the project". Plus the empty Directories settings section.

Try removing .idea from VCS for the moment (if that's possible ofc).

 

I have seen similar kind of tickets/threads (e.g. WI-60642 for instance)... but cannot find any good one right now where the possible reason would be clearly mentioned so I can tell "yep, that may be causing it".

2

Hi Andriy,

I think you are right. My .idea folder was not in VCS - in my main branch A, but yes, in branch B the file modules.xml was added earlier.

On top of that, a directory path in modules.xml was different from branch A and B.

It seems that the problem can be recreated by merging branch A into B.

Thanks 👍

0

To be a little more specific, this happens when the modules.xml is invalid or missing.

This happened again in another project, and I fixed it by creating modules.xml with the following link to the .iml file:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
    <component name="ProjectModuleManager">
      <modules>
        <module fileurl="file://$PROJECT_DIR$/.idea/path.to.iml" filepath="$PROJECT_DIR$/.idea/path.to.iml" />
      </modules>
    </component>
</project>

3

Also need to recreate this file .idea/path.to.iml. It was missing for me too. Copied from another project.

0

This is such an unfortunate bug, I've been trying to attract the team's attention to it for months now. We can't even open our own pre-configured projects in JetBrains, I am not sure how exactly only a few people notice that.
https://youtrack.jetbrains.com/issue/IDEA-271728

Please make sure to vote.

2

请先登录再写评论。