IDEA 中 Git Commit message 編寫


IDEA安裝插件 Git Commit Template


1. Header
Header的部分只有一行,包括三個字段: type(必需), scope(可選), subject(必需)

對應到idea插件上圖的配置分別為 Header部分的:

type(必需) Type of change commit類別
scope(可選) Scope of this change commint影響的范圍
subject(必需) Short description 簡短的描述
(1)type用於說明 commit 的類別,只允許使用下面7個標識
feat:新功能(feature)
fix:修補bug
docs:文檔(documentation)
style: 格式(不影響代碼運行的變動,空格,格式化,等等)
refactor:重構(即不是新增功能,也不是修改bug的代碼變動)
perf: 性能 (提高代碼性能的改變)
test:增加測試或者修改測試
build: 影響構建系統或外部依賴項的更改(maven,gradle,npm 等等)
ci: 對CI配置文件和腳本的更改
chore:對非 src 和 test 目錄的修改
revert: Revert a commit
(2) scope
scope用於說明 commit 影響的范圍,比如數據層、控制層、視圖層等等,視項目不同而不同。

(3) subject
subject是 commit 目的的簡短描述,不超過50個字符。

以動詞開頭,使用第一人稱現在時,比如change,而不是changed或changes
第一個字母小寫
結尾不加句號(.)
2. Body
Body 部分是對本次 commit 的詳細描述,可以分成多行。下面是一個范例。

More detailed explanatory text, if necessary. Wrap it to
about 72 characters or so.

Further paragraphs come after blank lines.

- Bullet points are okay, too
- Use a hanging indent

有兩個注意點。

(1)使用第一人稱現在時,比如使用change而不是changed或changes。

(2)應該說明代碼變動的動機,以及與以前行為的對比。

3. Footer
Footer 部分只用於兩種情況。

(1)不兼容變動

如果當前代碼與上一個版本不兼容,則 Footer 部分以BREAKING CHANGE開頭,后面是對變動的描述、以及變動理由和遷移方法。

BREAKING CHANGE: isolate scope bindings definition has changed.

To migrate the code follow the example below:

Before:

scope: {
myAttr: 'attribute',
}

After:

scope: {
myAttr: '@',
}

The removed `inject` wasn't generaly useful for directives so there should be no code using it.

(2)關閉 Issue

如果當前 commit 針對某個issue,那么可以在 Footer 部分關閉這個 issue 。

Closes #234
1
也可以一次關閉多個 issue 。

Closes #123, #245, #992
1
示例

————————————————
版權聲明:本文為CSDN博主「PostTruth」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/itguangit/article/details/99590995


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM