GIT提交注释规范

大厂如BAT(百度、阿里巴巴、腾讯)通常会制定自己的 Git 提交规范,这些规范有助于保持代码库的清晰性、可维护性,同时有助于自动化工具的集成,比如自动生成版本日志、自动化测试等。

以下是一些常见的 Git 提交规范标签及其含义,这些标签通常使用 Angular 团队的规范作为基础,不同公司可能会有一些定制化的修改:

  1. feat: 新增功能(feature)

    git commit -m "feat: add new feature X"
    
  2. fix: 修复 bug

    git commit -m "fix: resolve issue with Y"
    
  3. docs: 更新文档

    git commit -m "docs: update README"
    
  4. style: 代码风格的变化,不影响代码逻辑

    git commit -m "style: format code according to style guide"
    
  5. refactor: 代码重构,不是新增功能也不是修复 bug 的代码变动,可以是注释的调整 log:

    git commit -m "refactor: improve variable naming"
    
  6. test: 添加或修改测试代码

    git commit -m "test: add unit tests for component X"
    
  7. chore: 对构建过程或辅助工具和库的更改

    git commit -m "chore: upgrade dependencies"
    
  8. ci: 对 CI 配置文件和脚本的更改

    git commit -m "ci: configure Travis to run tests"
    
  9. perf: 提高性能的代码更改

    git commit -m "perf: optimize algorithm for faster processing"
    

这只是一个基本的示例,实际上,不同公司和团队可能会有不同的规范,也可能会根据实际需要添加一些特定的标签。建议查阅公司或团队的具体文档以获取最准确的信息。

https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit

posted @ 2023-10-17 10:46  Journey&Flower  阅读(732)  评论(0)    收藏  举报