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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章