我们这里涉及到三个 repo, 分别是:
-
https://gitlab.com/gitlab-org/gitlab.git
这是 GitLab 维护的 CE 和 EE 版本的分支, 是最源头的 repo.
记作:
ORG-REPO. -
https://gitlab.com/gitlab-jh/gitlab.git
Fork and Mirror from
ORG-REPO.额外添加的功能会放在
jh目录下.记作:
JH-REPO. -
https://gitlab.com/icbd/gitlab.git
Fork and Mirror from
ORG-REPO.主要用来给
ORG-REPO提交 MR .记作:
ICBD-REPO.
Flow
-
在
JH-REPO上开发新功能git checkout main-jh git pull git checkout -b feat/new_featureJH 特有的代码放到
jh目录下, 公共的的代码做到兼容 CE 和 EE .提交 MR 等待 CI 和 Review 通过.
-
在
ICBD-REPO上提取公共代码git remote add jh https://gitlab.com/gitlab-jh/gitlab.git git fetch jh feat/integrate_cn_version git checkout master git pull git checkout -b common/feat/new_feature # Pick commits and deal with conflicts git cherry-pick b441a0de..ddaf8745 # Squash commits git rebase -i 2b11c0c45b3 # Delete jh code and commit common code git reset HEAD^提交公共部分的修改到
ICBD-REPO.提交 MR 等待 CI 和 Review 通过.
-
在
JH-REPO上 rebaseORG-REPO的 MR Merge 之后, mirror 自动将改动 sync 给JH-REPO.由项目的 maintainer 更新
main-jh:git checkout main-jh git pull git fetch origin master git merge master由 developer 变基:
git fetch origin main-jh git checkout feat/new_feature git rebase main-jh重来一遍 CI 和 Review.
Merge.