.gitignore 中的隐藏文件夹

Hidden folders in .gitignore

我想忽略 IDE 中的隐藏文件夹 /.idea。我遵循了 https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore 的模式,但它并没有被忽略。

// .gitignore

# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules
package-lock.json
**/node_modules

# testing
/coverage

# production
/build

# Things that I have tried
.idea/
/.idea/
.idea/**

有什么方法可以忽略它?

如果您已经提交了 .idea 文件夹,则需要将其从 git 索引中删除

git rm --cached .idea

忽略 .gitignore 文件中文件夹的正确方法如下

.idea/