git提交规范

最近项目要规范git提交记录,这里记录一下相关事项

1. git commit规范

  • 统一格式:
//类型(作用范围): 对commit的简短描述
<type>(<scope>): <subject>
//如feat(home): 首页添加xx功能
  • type必填,表示提交的类型,一般有一下几种
    • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
    • ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
    • docs: Documentation only changes
    • feat: A new feature
    • fix: A bug fix
    • perf: A code change that improves performance
    • refactor: A code change that neither fixes a bug nor adds a feature
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
    • test: Adding missing tests or correcting existing tests
    • 可以参考https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines
  • scope表示commit的作用范围
  • subject对commit的简短描述
  • 一个功能合并成一个commit提交,如果已经提交了多个commit,用git rebase合并commit

2. 版本规范

  • 功能分支工作流,为各个新功能分配一个专门的分支开发
  • 合并代码之前,git rebase你要合并的分支,保持提交分支的干净,减少不必要的信息

你可能感兴趣的:(git)