PhpStorm 的 .gitignore
适用于 PhpStorm 的 34 条忽略规则,可直接复制到您的仓库。
JetBrains 用于 PHP 开发的 IDE
PhpStorm 的完整 .gitignore
# 由 LFGitignore - https://lfgitignore.com 生成
# 创建:2026-10-31 22:50:55 UTC
# 技术:PhpStorm
### PhpStorm ###
# IntelliJ 工作区设置
.idea/**/workspace.xml
# IntelliJ 任务
.idea/**/tasks.xml
# IntelliJ 使用统计
.idea/**/usage.statistics.xml
# IntelliJ 用户词典
.idea/**/dictionaries
# IntelliJ 搁置变更
.idea/**/shelf
.idea/**/aws.xml
# IntelliJ 内容模型
.idea/**/contentModel.xml
# IntelliJ 数据库配置
.idea/**/dataSources/
# IntelliJ 数据源 ID
.idea/**/dataSources.ids
# IntelliJ 本地数据源
.idea/**/dataSources.local.xml
# IntelliJ SQL 数据源
.idea/**/sqlDataSources.xml
# IntelliJ 动态元素
.idea/**/dynamic.xml
# IntelliJ UI 设计师
.idea/**/uiDesigner.xml
# IntelliJ 数据库导航器
.idea/**/dbnavigator.xml
# IntelliJ Gradle 设置
.idea/**/gradle.xml
# IntelliJ 项目库
.idea/**/libraries
cmake-build-*/
.idea/**/mongoSettings.xml
# IntelliJ 工作区文件
*.iws
out/
.idea_modules/
atlassian-ide-plugin.xml
.idea/replstate.xml
.idea/sonarlint/
# 参见 https://community.sonarsource.com/t/is-the-file-idea-idea-idea-sonarlint-xml-intended-to-be-under-source-control/121119
.idea/sonarlint.xml
com_crashlytics_export_strings.xml
# Crashlytics 配置
crashlytics.properties
# Crashlytics 构建
crashlytics-build.properties
# Fabric 属性文件
fabric.properties
.idea/httpRequests
http-client.private.env.json
.idea/caches/build_file_checksums.ser
.idea/.cache/.Apifox_Helper
.idea/ApifoxUploaderProjectSetting.xml
这些 PhpStorm 规则实际上忽略了什么
以下列出了每个忽略模式及其加入 .gitignore 的原因。
用户特定的东西
| 模式 |
忽略的内容 |
.idea/**/workspace.xml |
IntelliJ 工作区设置 |
.idea/**/tasks.xml |
IntelliJ 任务 |
.idea/**/usage.statistics.xml |
IntelliJ 使用统计 |
.idea/**/dictionaries |
IntelliJ 用户词典 |
.idea/**/shelf |
IntelliJ 搁置变更 |
AWS 用户特定
| 模式 |
忽略的内容 |
.idea/**/aws.xml |
AWS 用户特定 |
生成的文件
| 模式 |
忽略的内容 |
.idea/**/contentModel.xml |
IntelliJ 内容模型 |
敏感或高流失率文件
| 模式 |
忽略的内容 |
.idea/**/dataSources/ |
IntelliJ 数据库配置 |
.idea/**/dataSources.ids |
IntelliJ 数据源 ID |
.idea/**/dataSources.local.xml |
IntelliJ 本地数据源 |
.idea/**/sqlDataSources.xml |
IntelliJ SQL 数据源 |
.idea/**/dynamic.xml |
IntelliJ 动态元素 |
.idea/**/uiDesigner.xml |
IntelliJ UI 设计师 |
.idea/**/dbnavigator.xml |
IntelliJ 数据库导航器 |
Gradle
| 模式 |
忽略的内容 |
.idea/**/gradle.xml |
IntelliJ Gradle 设置 |
.idea/**/libraries |
IntelliJ 项目库 |
CMake
| 模式 |
忽略的内容 |
cmake-build-*/ |
CMake |
Mongo Explorer 插件
| 模式 |
忽略的内容 |
.idea/**/mongoSettings.xml |
Mongo Explorer 插件 |
基于文件的项目格式
| 模式 |
忽略的内容 |
*.iws |
IntelliJ 工作区文件 |
IntelliJ
| 模式 |
忽略的内容 |
out/ |
IntelliJ |
.idea_modules/ |
mpeltonen/sbt-idea 插件 |
JIRA插件
| 模式 |
忽略的内容 |
atlassian-ide-plugin.xml |
JIRA插件 |
Cursive Clojure 插件
| 模式 |
忽略的内容 |
.idea/replstate.xml |
Cursive Clojure 插件 |
SonarLint 插件
| 模式 |
忽略的内容 |
.idea/sonarlint/ |
SonarLint 插件 |
.idea/sonarlint.xml |
参见 https://community.sonarsource.com/t/is-the-file-idea-idea-idea-sonarlint-xml-intended-to-be-under-source-control/121119 |
Crashlytics 插件(适用于 Android Studio 和 IntelliJ)
| 模式 |
忽略的内容 |
com_crashlytics_export_strings.xml |
Crashlytics 插件(适用于 Android Studio 和 IntelliJ) |
crashlytics.properties |
Crashlytics 配置 |
crashlytics-build.properties |
Crashlytics 构建 |
fabric.properties |
Fabric 属性文件 |
基于编辑器的 HTTP 客户端
| 模式 |
忽略的内容 |
.idea/httpRequests |
基于编辑器的 HTTP 客户端 |
http-client.private.env.json |
基于编辑器的 HTTP 客户端 |
Android studio 3.1+ 序列化缓存文件
| 模式 |
忽略的内容 |
.idea/caches/build_file_checksums.ser |
Android studio 3.1+ 序列化缓存文件 |
Apifox 助手缓存
| 模式 |
忽略的内容 |
.idea/.cache/.Apifox_Helper |
Apifox 助手缓存 |
.idea/ApifoxUploaderProjectSetting.xml |
Apifox 助手缓存 |
如何将此 .gitignore 用于 PhpStorm
- 复制上面的PhpStorm规则,或者直接下载文件。
- 在 Git 仓库根目录创建名为 .gitignore 的文件,并将规则粘贴进去。
- 如果其中一些文件已被跟踪,请运行 git rm -r --cached . 然后再次提交 - Git 仅将忽略规则应用于未跟踪的文件。
- 提交 .gitignore 以便团队中的每个人都共享相同的规则。