# Git Commit Type 及 Templates 說明
## 目前統一使用下列 Commit Type
```
feat: 新功能
fix: Bug修復
docs: 文檔或設計靜態檔改變
style: 代碼格式改變
refactor: 功能重構
perf: 性能優化
test: 增加測試代碼
build: 改變build工具
ci: 與ci相關的設定
add: 增加一些跟功能無關的檔案
3rd: 增加第三方
sql: 資料庫相關
```
## 如果想要建立樣版的話可以透過下列方式操作
```
# 建立樣版檔
vi .git/.commit-msg-template
內容如下
# commit log 請遵造以下格式,並注意冒號後面有一個空格
#
# <Type>: <Subject> {必要}
# <Body> {非必要}
# <ISSUE_ID> {必要}
#
# 範例如下
# feat: add login api function
# 新增登入API功能
# GOG-001
#
# <Type>
# 請遵守下列標籤
# feat: 新功能
# fix: Bug修復
# docs: 文檔改變
# style: 代碼格式改變
# refactor: 功能重構
# perf: 性能優化
# test: 增加測試代碼
# build: 改變build工具
# ci: 與ci相關的設定
# add: 增加一些跟功能無關的檔案
# 3rd: 增加第三方
# sql: 資料庫相關
#
# <Subject>
# 用來簡要描述影響本次變動,概述即可
#
# <Body>
# 具體的修改訊息,越詳細越好
#
# <ISSUE_ID>
# Jira Issue 編號,例如 GOG-414 如有多個請使用空格分開,例如 GOG-414 GOG-123
# 設定樣版關聯
git config commit.template .git/.commit-msg-template
# 實際使用
touch test.txt
git add .
git commit
就會自動打開樣版內容了,你再自行將註解拿掉即可(注意如果開頭是#會被乎略喔)
例如
feat: add login api function
新增登入API功能
GOG-001
```
{"metaMigratedAt":"2023-06-18T01:57:33.623Z","metaMigratedFrom":"YAML","title":"Git Commit Type 及 Templates 說明","breaks":true,"description":"Git Commit Type 及 Templates 說明","contributors":"[{\"id\":\"31a6cbdf-3837-4fc5-ba2d-b6ba06a4dcea\",\"add\":1104,\"del\":0}]"}