Skip to content

Commit

Permalink
feat: 添加GIT提交指南🤣
Browse files Browse the repository at this point in the history
  • Loading branch information
ming995 committed Apr 16, 2019
1 parent db6f19b commit cd00383
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# osx
.DS_Store

# vscode
.vscode
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Git是一个 “分布式版本管理工具”,简单的理解版本管理工
* [把暂存区的指定 file 放到工作区中](#把暂存区的指定-file-放到工作区中)
* [强制推送](#强制推送)
* [一图详解](#一图详解)
* [优雅的提交Commit信息](#优雅的提交Commit信息)
* [联系我](#联系我)

## 展示帮助信息
Expand Down Expand Up @@ -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/)
Expand Down
File renamed without changes
Binary file added assets/gitcz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cd00383

Please sign in to comment.