A. 代码分支结构
GitLab使用时,基本遵循gitflow的工作量(目前因为历史原因,是非标准gitflow)
目前的分支结构和权限如下:
分支 | merge权限 | push权限 |
---|---|---|
feat特性分支 | Maintainer用户 + Developer用户 | Maintainer用户 + Developer用户 |
dev/sit | Maintainer用户 | Maintainer用户 |
uat | Maintainer用户 | Maintainer用户 |
master/release | Maintainer用户 | Maintainer用户 |
hotfix | Maintainer用户 | Maintainer用户 |
B.git commit message规范
统一使用 IDEA的git commit template插件来提交
各个部分的说明如下:
Type of change
代码提交类型 | 英文说明 | 中文说明 |
---|---|---|
feat | A new feature | 新特性 |
fix | A bug fix | 解决bug |
docs | Documentation only changes | 文档变更 |
style | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) | 代码风格变更 |
refactor | A code change that neither fixes a bug nor adds a feature | 代码重构 |
perf | A code change that improves performance | 代码性能优化 |
test | Adding missing tests or correcting existing tests | 测试变化 |
build | Changes that affect the build system or external dependencies (example scopes : gulp, broccoli, npm, maven) | 构建变化 |
ci | Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowseStack, SauceLabs, Jenkins) | 持续集成变化 |
chore | Other changes that don't modify src or test files | 其余变化 |
revert | Reverts a previous commit | 代码回退 |
开发提交git commit是要填写的内容、填写规范及示例
需要填写的内容 | 说明 | 填写规范 | 示例 |
---|---|---|---|
Scope of this change | 提交影响的范围 | ||
Short description | 概要描述 | ||
Long description | 详细描述 | ||
Breaking changes | 突出的改变 | ||
Closed issues | 关闭的issue |
C. 代码提交流程如下
a.代码的稳定版本为master分支,所有新功能拉出一条新特性分支开发。
b.当新特性分支开发完成之后,merge到develop分支中进行连调。联调中需修改的问题,在特性分支修改后megre到develop分支重新部署。
c.当联调完成时,将特性分支merge到sit分支提测。bug修复在特性分支中修复,完成后合并到sit分支中。
d.当测试完成时,将特性分支merge到uat分支进行验收。如需要修改,在特性分支进行修改,完成后部署UAT验证。
e.当验收完成时,从之前一个release上拉出一条全新的分支用作上线版本,之前版本用作备份。将特性分支merge到新release分支进行部署。
f.生产release分支,保存三个版本的有效期,即新上线分支上线后,删除之前的倒数第四个版本。
g.当存在生产问题是,从最新release中拉出hotfix分支,改完后走之前相同流程测试,测试通过之后合到release版本中上线。
h.生产发版完成后,请将特性分支merge到dev/sit,uat环境一遍,同步代码。
参考资料:
[1] IDEA集成Git