Skip to content

Instantly share code, notes, and snippets.

@bsed
Created April 12, 2018 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsed/55c571ea7943043fba80913e905a2fdb to your computer and use it in GitHub Desktop.
Save bsed/55c571ea7943043fba80913e905a2fdb to your computer and use it in GitHub Desktop.
.gitmessage
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
# --- COMMIT END ---
# Type can be
# feat (new feature)
# fix (bug fix)
# docs (changes to documentation)
# style (formatting, missing semi colons, etc; no code change)
# refactor (refactoring production code)
# test (adding missing tests, refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)
# --------------------
# Remember to
# Separate subject from body with a blank line
# Limit the subject line to 50 characters
# Capitalize the subject line
# Do not end the subject line with a period
# Use the imperative mood in the subject line
# Wrap the body at 72 characters
# Use the body to explain what and why vs. how
# Can use multiple lines with "-" for bullet points in body
# --------------------
# For more information about this template, check out
# https://gist.github.com/bsed/55c571ea7943043fba80913e905a2fdb
@bsed
Copy link
Author

bsed commented Apr 12, 2018

一份建议的git commit模板
# <类型>: (类型的值见下面描述) <主题> (最多50个字)

# 解释为什么要做这些改动
# |<----  请限制每行最多72个字   ---->|

# 提供相关文章和其它资源的链接和关键字
# 例如: Github issue #23

# --- 提交 结束 ---
# 类型值包含
#    feat (新特性)
#    fix (bug修复)
#    docs (文档改动)
#    style (格式化, 缺失分号等; 不包括生产代码变动)
#    refactor (重构代码)
#    test (添加缺失的测试, 重构测试, 不包括生产代码变动)
#    chore (更新grunt任务等; 不包括生产代码变动)
# --------------------
# 注意
#    主题和内容以一个空行分隔
#    主题限制为最大50个字
#    主题行大写
#    主题行结束不用标点
#    主题行使用祈使名
#    内容每行72个字
#    内容用于解释为什么和是什么,而不是怎么做
#    内容多行时以'-'分隔
# --------------------
# 模板更多信息详见下面地址
https://gist.github.com/bsed/55c571ea7943043fba80913e905a2fdb

@bsed
Copy link
Author

bsed commented Apr 12, 2018

应用模板,
先保存 模板 文件到本机, 使用下面命令

git config --global commit.template <.git-commit-template.txt file path>
例如:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment