Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phpstorm git attempts to commit workspace.xml

Tags:

git

phpstorm

I have excluded .idea/ folder in perferences, but when I try to commit changes, phpstorm tries to commit workspace.xml file. Why?

enter image description here

like image 318
Hast Avatar asked Jan 20 '26 11:01

Hast


2 Answers

For what I see, .idea/workspace.xml seems to be deleted, so it means it was previously tracked by git.

EDIT: You have accidentally committed this file, so you want to remove it from the repo but not from your working copy.

For this you have to use the --cached flag of git rm:

$ git rm --cached .idea/workspace.xml

From git help rm:

   --cached
       Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone.

You'll have to commit the deletion if you want the file to not be included in the repository code anymore.

Instead, if you want to leave the file there but stop tracking further changes to that file, you should use git's assume-unchanged option.

From the command line, that's like:

$ git update-index --assume-unchanged .idea/workspace.xml

I don't really know how to do that with the GUI you're using.

like image 105
mgarciaisaia Avatar answered Jan 23 '26 04:01

mgarciaisaia


The answer was: simply add .idea/ to .gitignore file in the root of my application.

like image 23
Hast Avatar answered Jan 23 '26 05:01

Hast



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!