我在首选项中排除.idea/了文件夹,但是当我尝试提交更改时,phpstorm 会尝试提交 workspace.xml 文件。为什么?

对于我所看到的,.idea/workspace.xml似乎被删除了,所以这意味着它以前被 git 跟踪过。
编辑: 您不小心提交了此文件,因此您想将其从存储库中删除,而不是从您的工作副本中删除。
为此,您必须使用以下--cached标志git rm:
$ git rm --cached .idea/workspace.xml
来自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.
如果您希望文件不再包含在存储库代码中,则必须提交删除。
相反,如果您想将文件保留在那里但停止跟踪对该文件的进一步更改,则应使用git'assume-unchanged选项。
从命令行,就像:
$ git update-index --assume-unchanged .idea/workspace.xml
我真的不知道如何使用您使用的 GUI 来做到这一点。
答案是:只需添加.idea/到我的应用程序根目录中的 .gitignore 文件即可。