Overview
Set up protected branch rules during collaborative coding to enhance code quality, safeguard branches, and boost teamwork for reliable, secure code delivery.
This section provides an overview of the best practices including:
Application Scenarios
Developing code without protected branch rules may interrupt your development pace and even delivery.
- Merging unreviewed code into main branches may cause defects and further incur online faults and higher O&M costs.
- Key branches are forcibly pushed and overwritten, causing historical records to be lost. As a result, problems are difficult to trace, affecting fault locating and compliance audit.
- CI/CD process is not strictly followed. As a result, bad code enters the production environment, which may cause version rollback or user complaints.
- Unstandardized collaboration and random branch merge cause frequent code conflicts and disrupted version iteration.
Protected branch rules can help you solve the following pain points:
- Core branches (such as master): No role is allowed to push code to core branches. Only compliant code can be brought online, reducing production risks.
- Permission control: Only authorized members can merge key branches to block unqualified code and maintain enterprise security standards.
Advantages
Setting protected branch rules for key code branches in CodeArts Repo, your team will enjoy the following core advantages:
- Prevent direct code push. Submitting changes via merge requests can shield developers from directly pushing code to the protected branches, facilitating code review.
- Ensure code quality. Merging merge requests by authorized members improves code maintainability.
- Control permissions and compliance. Allowing authorized members to merge code strengthens enterprises' hierarchical management and helps trace code change sources.
- Reduce conflicts and improve collaboration efficiency. Prohibiting direct pushes to protected branches minimizes code conflicts caused by members' unstandardized operations and helps new members quickly get started by standardizing the push process.
Constraints
Only a project manager or project administrator can configure protected branch rules for all repositories in a project. Refer to the following steps:
- As shown in the following figure, go to the Repo page of Test_Project to be configured.
Figure 1 Repo page of Test_Project
- In the left navigation pane, choose Settings > Members. As shown in the following figure, the current user is a project manager and project administrator. Therefore, the current user has the permission to configure protected branch rules for the project.
Figure 2 Member view page
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot