Workflow
Git Workflow
Commit Message | 提交信息规范
目前规范使用较多的是
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
我们通过
- 标题行
: 必填, 描述主要修改类型和内容 - 主题内容
: 描述为什么修改, 做了什么样的修改, 以及开发的思路等等 - 页脚注释
: 放Breaking Changes 或Closed Issues
分别由如下部分构成
type: commit 的类型feat: 新特性fix: 修改问题refactor: 代码重构docs: 文档修改style: 代码格式修改, 注意不是css 修改test: 测试用例修改chore: 其他修改, 比如构建流程, 依赖管理.
scope: commit 影响的范围, 比如: route, component, utils, build …subject: commit 的概述, 建议符合 50/72 formattingbody: commit 具体修改内容, 可以分为多行, 建议符合 50/72 formattingfooter: 一些备注, 通常是BREAKING CHANGE 或修复的bug 的链接.
模板
这样一个符合规范的
[commit]
template = ~/.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
#
Merge Request
推荐团队中采用
git checkout dev
git pull --rebase --prune
git checkout -b feat/x # or fix/y
# coding time
# may commit several times
git commit -m ''
# make sure rebase from origin dev branch
git fetch
git rebase origin/dev
git push # maybe `-f` flag is required if you've pushed before rebase
# create Merge Request to dev branch
# code changes according MR review
# confirm to rebase again in case others merged before your MR
git fetch
git rebase origin/dev
git push
Links
2018- 优雅的提交你的Git Commit Message : commit message 是开发的日常操作, 写好log 不仅有助于他人review, 还可以有效的输出CHANGELOG, 对项目的管理实际至关重要, 但是实际工作中却常常被大家忽略。