Hybrid Code Review Service: Combining CHANGE and Merge Request in Ctrip's GitLab Platform
This article analyzes the advantages of Gerrit’s pre‑commit CHANGE workflow and GitLab’s Merge Request, proposes a hybrid code‑review service that integrates both approaches, and outlines the scenarios where each method or their combination best fits development teams seeking higher code quality and efficient integration.
Author Introduction Su Ling – 5 years of software configuration management and 7 years of continuous integration experience, former senior configuration management engineer at Suzhou Keda Technology and Dianping, now head of Ctrip Code Center. Li Haitao – senior development engineer at Ctrip Code Center, responsible for implementing GitLab sharding and hybrid code‑review services.
1. Overview Since 2013, Ctrip has used both Gerrit and GitLab for code review. Gerrit offers a pre‑commit review model, while GitLab provides post‑commit review via Merge Requests (MR). To unify the platform, Ctrip introduced a hybrid service on GitLab that supports both Gerrit‑style CHANGE and GitLab MR.
2. Terminology CHANGE: each local commit automatically creates a change; unreviewed changes cannot enter the shared Git repository. MR: each review involves creating two branches and submitting a Merge Request.
3. Gerrit vs. GitLab Comparison The article presents a dialogue between “Mr. Gerrit” and “Mr. GitLab” highlighting strengths such as pre‑commit protection, automatic review request on push, linear history, and branch‑level review. A summary table (translated) shows which platform wins for each advantage.
Specific Advantage
Is Advantage?
Gerrit
GitLab
Conclusion
Unreviewed code cannot enter repository
Yes
Yes
Yes (requires fork)
Gerrit wins
Push automatically creates review request
Yes
Yes
No
Gerrit wins
Review at branch level instead of each commit
Yes (in some cases)
No
Yes
GitLab wins
Review single commit for quality
Yes (in some cases)
Yes
No
Gerrit wins
Support linear history
Yes
Yes
Yes
Tie
4. Scenarios Particularly Suited for CHANGE Scenario 1: Projects that develop directly on the trunk branch. Scenario 2: Teams that place a strong emphasis on code quality and avoid forks. Scenario 3: Teams with many junior developers who need every change reviewed before it reaches the repository.
5. Using CHANGE and MR Together When both are used, junior developers push to refs/for/Feature‑A , reviewers approve the CHANGE, and later a Merge Request merges the feature branch into master, eliminating extra branch creation and MR steps.
6. Hybrid Service Implementation The hybrid service retains Gerrit‑style local operations (e.g., git push origin HEAD:refs/for/ ) and adds GitLab‑style clone URLs and UI support for both CHANGE and MR.
7. Review Mode Types and Applicable Scenarios Four modes are defined: CHANGE only, CHANGE+MR, MR only, and no code review. Each mode is matched with conditions such as product quality requirements, trunk‑based development, and the skill level of developers.
8. Conclusion The hybrid code‑review service provides flexibility for companies with diverse branching strategies, allowing them to benefit from both pre‑commit protection and the convenience of Merge Requests, and signals Ctrip’s move to fully replace Gerrit with GitLab.
Ctrip Technology
Official Ctrip Technology account, sharing and discussing growth.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.