Vue .gitignore

Vue.js 是一种流行的开源 JavaScript 框架,被广泛用于构建现代化的 Web 应用程序。Vue.js 用于构建用于数据响应的单页面应用程序,但是在处理大型项目时可能会出现许多临时文件和配置文件,这些文件可以使用 .gitignore 文件从 Git 跟踪中排除。

Vue.js 有一个标准的 .gitignore 文件,可以覆盖大多数用例。通常,您应该将 .gitignore 文件放在 Git 存储库的根目录中。这将确保 Git 忽略存储库包含的所有不需要的文件。

# Ignore build generated files
dist/
build/
config/
# Ignore Node.js runtime files
node_modules/
# Ignore files generated by IDEs and editors
.vscode/
.idea/
# Ignore logs and other runtime files
logs/
tmp/
*.log
# Ignore test data
test-data/

该 .gitignore 文件将忽略生成的文件,如 dist、build 和 config 文件夹。它还将忽略 Node.js 运行时文件,如 node_modules 文件夹以及来自 IDE 和编辑器的文件,如 .vscode 和 .idea 文件夹。此文件还将忽略特定的运行时文件,如日志文件、tmp 文件以及 test-data 文件夹。

在大型项目中,可能需要更新 .gitignore 文件以包括其他临时文件和配置文件。如果您需要执行此操作,请确保遵循 Git 的最佳实践,并小心处理源代码和 Git 提交中的潜在敏感信息。

https://www.yzktw.com.cn/post/1209301.html

 

======================================

创建

在根目录下创建 .gitignore 文件,在.gitignore 文件下添加如下配置
语法规范

    以 / 开头忽略当前目录下的文件,但不包括子目录下的文件
    以 / 结尾忽略目录下所有文件及内容,不管是根目录或子目录都会被忽略
    以 # 开头表示注释
    以 * 匹配零个或多个字符
    以 ? 匹配单个字符
    以 [] 匹配括号内的任一字符
    ! 表示不忽略(跟踪)匹配到的文件或目录
    不添加任何符号表示直接忽略当前目录下的这个文件

前端开发常用的配置如下

.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

package-lock.json
yarn.lock

链接:https://blog.csdn.net/Komorebi_00/article/details/126418325

 

posted @ 2024-05-01 20:06  emanlee  阅读(172)  评论(0编辑  收藏  举报