1. 创建/编辑 .gitignore 文件

在项目根目录下找到或创建 .gitignore 文件,添加以下内容:

#IDE 配置文件
.idea/
*.iml
.DS_Store

2. 如果 .idea 已经被 Git 追踪

如果 .idea 文件夹已经被 Git 追踪了,需要先停止追踪再忽略:

2.1 在终端执行以下命令

git rm -r --cached .idea
git rm --cached *.iml
git commit -m "Remove .idea from git tracking"

2.2 提交 .gitignore 文件

git add .gitignore
git commit -m "Add .gitignore to ignore IDE files"
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐