Git:提交消息 conventions/formats
Git: commit message conventions/formats
如何在git中调用这种提交消息?
fix(short message): expanded message
docs(short message): expanded message
feat(short message): expanded message
refactor(short message): expanded message
您会在 Karma
中找到该约定
<type>(<scope>): <subject>
<body>
<footer>
它可以帮助:
- 自动生成变更日志
- 通过 git 历史记录进行简单导航(例如,忽略样式更改)
Karma 的约定包括:
Allowed <type>
values:
- feat (new feature for the user, not a new feature for build script)
- fix (bug fix for the user, not a fix to a build script)
- docs (changes to the documentation)
- style (formatting, missing semi colons, etc; no production code change)
- refactor (refactoring production code, eg. renaming a variable)
- test (adding missing tests, refactoring tests; no production code change)
- chore (updating grunt tasks etc; no production code change)
Example <scope>
values:
- init
- runner
- watcher
- config
- web-server
- proxy
- etc.
注意:git 提交消息不应以空白行或空行开头。
这不是非法的,但在 git 2.10(2016 年第 3 季度)中,某些操作默认会修剪这些行。
参见 commit 054a5ae, commit 88ef402, commit 84e213a, commit 84e213a (29 Jun 2016), commit 88ef402, commit 84e213a (29 Jun 2016), commit 84e213a (29 Jun 2016), and commit 4e1b06d, commit 7735612 (22 Jun 2016) by Johannes Schindelin (dscho
)。
(由 Junio C Hamano -- gitster
-- in commit 62e5e83 合并,2016 年 7 月 11 日)
reset --hard
: skip blank lines when reporting the commit subject
When there are blank lines at the beginning of a commit message, the
pretty printing machinery already skips them when showing a commit
subject (or the complete commit message).
We shall henceforth do the
same when reporting the commit subject after the user called
git reset --hard <commit>
commit -C
: skip blank lines at the beginning of the message
(即当您使用现有的提交对象,并在创建提交时重用日志消息和作者身份信息(包括时间戳))
Consistent with the pretty-printing machinery, we skip leading blank
lines (if any) of existing commit messages.
While Git itself only produces commit objects with a single empty line
between commit header and commit message, it is legal to have more than
one blank line (i.e. lines containing only white space, or no
characters) at the beginning of the commit message, and the
pretty-printing code already handles that.
commit.c
: make find_commit_subject()
more robust
Just like the pretty printing machinery, we should simply ignore
blank lines at the beginning of the commit messages.
This discrepancy was noticed when an early version of the
rebase--helper
produced commit objects with more than one empty line
between the header and the commit message.
如何在git中调用这种提交消息?
fix(short message): expanded message
docs(short message): expanded message
feat(short message): expanded message
refactor(short message): expanded message
您会在 Karma
中找到该约定<type>(<scope>): <subject>
<body>
<footer>
它可以帮助:
- 自动生成变更日志
- 通过 git 历史记录进行简单导航(例如,忽略样式更改)
Karma 的约定包括:
Allowed
<type>
values:
- feat (new feature for the user, not a new feature for build script)
- fix (bug fix for the user, not a fix to a build script)
- docs (changes to the documentation)
- style (formatting, missing semi colons, etc; no production code change)
- refactor (refactoring production code, eg. renaming a variable)
- test (adding missing tests, refactoring tests; no production code change)
- chore (updating grunt tasks etc; no production code change)
Example
<scope>
values:
- init
- runner
- watcher
- config
- web-server
- proxy
- etc.
注意:git 提交消息不应以空白行或空行开头。
这不是非法的,但在 git 2.10(2016 年第 3 季度)中,某些操作默认会修剪这些行。
参见 commit 054a5ae, commit 88ef402, commit 84e213a, commit 84e213a (29 Jun 2016), commit 88ef402, commit 84e213a (29 Jun 2016), commit 84e213a (29 Jun 2016), and commit 4e1b06d, commit 7735612 (22 Jun 2016) by Johannes Schindelin (dscho
)。
(由 Junio C Hamano -- gitster
-- in commit 62e5e83 合并,2016 年 7 月 11 日)
reset --hard
: skip blank lines when reporting the commit subjectWhen there are blank lines at the beginning of a commit message, the pretty printing machinery already skips them when showing a commit subject (or the complete commit message).
We shall henceforth do the same when reporting the commit subject after the user called
git reset --hard <commit>
commit -C
: skip blank lines at the beginning of the message
(即当您使用现有的提交对象,并在创建提交时重用日志消息和作者身份信息(包括时间戳))
Consistent with the pretty-printing machinery, we skip leading blank lines (if any) of existing commit messages.
While Git itself only produces commit objects with a single empty line between commit header and commit message, it is legal to have more than one blank line (i.e. lines containing only white space, or no characters) at the beginning of the commit message, and the pretty-printing code already handles that.
commit.c
: makefind_commit_subject()
more robustJust like the pretty printing machinery, we should simply ignore blank lines at the beginning of the commit messages.
This discrepancy was noticed when an early version of the
rebase--helper
produced commit objects with more than one empty line between the header and the commit message.