git mesage usage

发布时间 2023-08-03 07:47:24作者: petercao

~/.gitmessage.txt 可以是任意的文件名,参考

git 官网文档,搜索default message
https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

git config --global commit.template ~/.gitmessage.txt

 

method 1:
git config --global commit.template ~/.gitmessage

method 2:
vi ~/.gitconfig

[core]
editor = vim
[credential]
helper = store
[commit]
template = ~/.gitmessage

 

新建 ~/.gitmessage 内容可以如下:

# head: <type>(<scope>): <subject>
# - type: feat, fix, docs, style, refactor, test, chore
# - scope: can be empty (eg. if the change is a global or difficult to assign to a single component)
# - subject: start with verb (such as 'change'), 50-character line
#
# body: 72-character wrapped. This should answer:
# * Why was this change necessary?
# * How does it address the problem?
# * Are there any side effects?
#
# footer:
# - Include a link to the ticket, if any.
# - BREAKING CHANGE
#