我在Rails项目中使用Rubymine。通常情况下,Rubymine在.idea/*文件中做了一些我并不关心的更改。但它一直阻止我查看新的分支,并使我的.idea版本与我的同事不同。

我们已经向.gitignore添加了.idea/,但它会跟踪.idea中的变化。我该怎么做才对呢?

下面是我得到的一个典型的错误消息:

error: Your local changes to the following files would be overwritten by checkout:
    .idea/workspace.xml

当前回答

.idea/*怎么样?没有测试,但应该可以

其他回答

JetBrains在GitHub上有一个.gitignore_global。

我试着把这些文件添加到我的。gitignore,它是无用的…

然而,正如Petr Syrov所说,你可以使用git rm -r——cached .idea到你的终端,这些文件将不再是一个问题!

如果Git已经在跟踪某个文件,那么将该文件添加到.gitignore不会阻止Git跟踪它。你需要先对有问题的文件进行git管理,然后添加到你的.gitignore中。

加上。idea/应该有用

关闭PHP Storm 在终端转到项目文件夹 类型

git rm -rf .idea; git commit -m "delete .idea"; git push;

然后进入项目文件夹,删除文件夹。idea

sudo rm -r .idea/

启动PhpStorm,你就完成了

我建议阅读git手册页,以充分理解忽略是如何工作的,将来你会感谢我的;)

与你的问题相关的:

Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:

A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same     as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo".

A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .    gitignore file, with infinite depth.

A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b",     "a/x/y/b" and so on.

Other consecutive asterisks are considered invalid.