feat: 添加GIT提交指南🤣

master
ming995 2019-04-17 00:21:22 +08:00
parent db6f19b848
commit cd00383087
4 changed files with 47 additions and 1 deletions

5
.gitignore vendored 100644
View File

@ -0,0 +1,5 @@
# osx
.DS_Store
# vscode
.vscode

View File

@ -92,6 +92,7 @@ Git是一个 “分布式版本管理工具”,简单的理解版本管理工
* [把暂存区的指定 file 放到工作区中](#把暂存区的指定-file-放到工作区中)
* [强制推送](#强制推送)
* [一图详解](#一图详解)
* [优雅的提交Commit信息](#优雅的提交Commit信息)
* [联系我](#联系我)
## 展示帮助信息
@ -640,7 +641,47 @@ git push -f <remote-name> <branch-name>
## 一图详解
![](git.png)
![](./assets/git.png)
## 优雅的提交Commit信息
使用[Angular团队提交规范](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines)
主要有以下组成
* 标题行: 必填, 描述主要修改类型和内容
* 主题内容: 描述为什么修改, 做了什么样的修改, 以及开发的思路等等
* 页脚注释: 放 Breaking Changes 或 Closed Issues
常用的修改项
* type: commit 的类型
* feat: 新特性
* fix: 修改问题
* refactor: 代码重构
* docs: 文档修改
* style: 代码格式修改, 注意不是 css 修改
* test: 测试用例修改
* chore: 其他修改, 比如构建流程, 依赖管理.
* scope: commit 影响的范围, 比如: route, component, utils, build...
* subject: commit 的概述
* body: commit 具体修改内容, 可以分为多行
* footer: 一些备注, 通常是 BREAKING CHANGE 或修复的 bug 的链接.
### 使用`Commitizen`代替 git commit
可以使用[cz-cli](https://github.com/commitizen/cz-cli)工具代替 `git commit`
全局安装
```shell
npm install -g commitizen cz-conventional-changelog
echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc
```
全局安装后使用 `git cz` 代替 `git commit`就可以了,如下图
![](./assets/gitcz.png)
## 联系我
- 博客园:[削微寒](http://www.cnblogs.com/xueweihan/)

View File

Before

Width:  |  Height:  |  Size: 474 KiB

After

Width:  |  Height:  |  Size: 474 KiB

BIN
assets/gitcz.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB