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