Source code management device capable of automatically merging code branches in multi-branch development scene
By introducing the code base operation module, event monitoring module and automatic merge command generation module in the multi-branch development scenario, automatic synchronization between branches is achieved, solving the inefficiency and conflict problems caused by manual merging, and improving the work efficiency of engineers and the accuracy of code merging.
Patent Information
- Application Number
- CN202510685034.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-09-05
AI Technical Summary
In a multi-branch development scenario, engineers need to manually merge the main branch code, which is inefficient and may cause code conflicts and defects.
A source code management device for automatically merging code branches in a multi-branch development scenario is adopted, which includes a code base operation module, an event monitoring module, a synchronization rule configuration module and an automatic merging command generation module to achieve automatic synchronization between branches.
It reduces engineers' manual operations, improves work efficiency, reduces the risk of code conflicts and defects, and ensures the automation and accuracy of code merging.
Smart Images

Figure CN120596080A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data management, and in particular to a source code management device for automatically merging code branches in a multi-branch development scenario. Background Art
[0002] In the software development industry, large-scale collaborative development scenarios often require multi-branch development. For example, a development engineer receives a requirement task and, based on the latest code from the main branch, pulls different functional development branches to develop and self-test the feature. After self-testing, the code is merged into the main branch for integration testing and deployment to the production environment.
[0003] In the above scenario, because the trunk branch code will be constantly merged with new code by different development engineers, when conducting branch development, development engineers need to constantly merge the latest trunk code into their own development branches. Otherwise, when the code is finally merged into the trunk branch, not only may a large number of code conflicts occur, but also serious code defects may be caused.
[0004] The purpose of merging the latest main branch code into your own development branch is to merge the code merged into the main branch by others into your own development branch as early as possible, check in advance whether there are conflicts in the code, whether it will cause defects, and reduce the risk of finally merging it into the main branch.
[0005] Similarly, for scenarios with test branches, test engineers usually need to manually merge the latest code from the main branch into the test branch. This is because different teams use different branch models when conducting branch development. This is not explained in detail here. We will only use the above simple scenario as an example to illustrate the code merging problem of development engineers' development branch codes.
[0006] The above-mentioned method of relying on engineers to manually merge trunk and branch codes is relatively inefficient because it requires engineers to invest time in manual operations, and engineers do not know when new code from others will be merged into the trunk code. Therefore, this manual operation sometimes results in useless waste of actions. Therefore, this application proposes a source code management device that automatically merges code branches in a multi-branch development scenario to solve the above-mentioned problem. Summary of the Invention
[0007] The purpose of the present invention is to provide a source code management device for automatically merging code branches in a multi-branch development scenario, so as to solve the problem proposed in the above background technology that engineers need to manually merge branches between different branches in a multi-branch development scenario, which is inefficient.
[0008] To achieve the above object, the present invention provides the following technical solutions:
[0009] A source code management device for automatically merging code branches in a multi-branch development scenario includes a common source code management server and a code base branch automatic merging processing module. The common source code management server includes a code base operation module, a code base branch, and a code base event notification module. The code base branch automatic merging processing module includes a code base event monitoring module, a code synchronization rule configuration module, a code base event processing module, and a branch automatic merging command generation module.
[0010] As a further solution of the present invention: the code library operation module is used to process normal user operations.
[0011] As a further solution of the present invention: the user operation specifically includes downloading code, submitting code and creating a branch.
[0012] As a further solution of the present invention: the code library event monitoring module is used to subscribe to and monitor code library events.
[0013] As a further solution of the present invention: the code synchronization rule configuration module is used to configure rules for automatic synchronization of codes between different branches.
[0014] The source code management method for automatically merging code branches in a multi-branch development scenario has the following steps:
[0015] Step 1: The user first submits code to a branch of the code library;
[0016] Step 2: After receiving the user's command, the code base operation module further operates on the branch;
[0017] Step 3: The code base operation module generates a code base event and further transmits it to the code base event notification module;
[0018] Step 4: The code base event monitoring module monitors the branch code submission event;
[0019] Step 5: The code base event processing module further initiates a query request to the code synchronization rule configuration module to query and obtain the rule configuration content;
[0020] Step 6: The codebase event processing module compares the rule configuration content obtained in step 5 with the event content obtained in step 4. If the event triggering condition in the rule configuration content does not match the event content obtained in step 4, the process ends; otherwise, the operation details in the rule configuration content obtained in step 5 are passed to the branch automatic merge command generation module;
[0021] Step 7: The branch automatic merge command generation module further generates a branch code automatic merge command based on the operation details obtained in step 6;
[0022] Step 8: The branch automatic merge command generation module further informs the code base operation module according to the command generated in step 7;
[0023] Step 9: The code base operation module further operates the code base branch according to the command received in step 8 to complete the automatic synchronization of codes between different branches.
[0024] As a further solution of the present invention: in the step 4, it is determined whether it is a branch code merging event. If not, the process ends; if so, the event content is notified to the code library event processing module and it is required to perform further processing.
[0025] Compared with the prior art, the present invention has the following beneficial effects:
[0026] In the branch development mode of the software development process of the present invention, when the code of certain branches is merged into the new code, the branches that need to be updated do not need manual code synchronization operations by development engineers. The system of the present invention will automatically synchronize the codes between branches according to pre-configured rules, which greatly improves the work efficiency of engineers and reduces omissions and accidents caused by manual operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic diagram of the system structure of a source code management device for automatically merging code branches in a multi-branch development scenario. DETAILED DESCRIPTION
[0028] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0029] See also Figure 1In an embodiment of the present invention, a source code management device for automatically merging code branches in a multi-branch development scenario includes a common source code management server and a code base branch automatic merging processing module. The common source code management server includes a code base operation module, a code base branch, and a code base event notification module. The code base operation module is used to process normal user operations, which specifically include downloading code, submitting code, and creating branches. The code base branch automatic merging processing module includes a code base event monitoring module, a code synchronization rule configuration module, a code base event processing module, and a branch automatic merging command generation module. The code base event monitoring module is used to subscribe to and monitor code base events. The code synchronization rule configuration module is used to configure rules for automatic synchronization of code between different branches. The rule configuration content includes event triggering conditions and operation details.
[0030] The source code management method for automatically merging code branches in a multi-branch development scenario has the following steps:
[0031] Step 1: The user first submits code to a branch of the code base, as shown by arrow 1;
[0032] Step 2: After receiving the user command, the code base operation module further operates on the branch, as shown by arrow 2;
[0033] Step 3: The code base operation module generates a code base event and further transmits it to the code base event notification module, as shown by arrow 3;
[0034] Step 4: The code base event monitoring module monitors the branch code submission event and further determines whether it is a branch code merge event. If not, the process ends; if so, the event content is notified to the code base event processing module and requested to further process it, as shown by arrow 4;
[0035] Step 5: The code base event processing module further initiates a query request to the code synchronization rule configuration module to query and obtain the rule configuration content, as shown by arrows 5 and 6;
[0036] Step 6: The codebase event processing module compares the rule configuration content obtained in step 5 with the event content obtained in step 4. If the event triggering condition in the rule configuration content does not match the event content obtained in step 4, the process ends; otherwise, the operation details in the rule configuration content obtained in step 5 are passed to the branch automatic merge command generation module, as shown by arrow 7;
[0037] Step 7: The branch automatic merge command generation module further generates a branch code automatic merge command based on the operation details obtained in step 6;
[0038] Step 8: The branch automatic merge command generation module further informs the code base operation module according to the command generated in step 7, as shown by arrow 8;
[0039] Step 9: The code base operation module further operates the code base branch according to the command received in step 8 to complete the automatic synchronization of codes between different branches.
[0040] In the branch development mode of the current software development process, when the code of certain branches (such as the main branch) is merged into the new code, the branches that need to be updated do not need manual code synchronization operations by development engineers. The system of the present invention will automatically synchronize the codes between branches according to pre-configured rules, which greatly improves the work efficiency of engineers and reduces omissions and accidents caused by manual operations.
[0041] Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments, or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A source code management device for automatically merging code branches in a multi-branch development scenario, comprising a common source code management server and a code base branch automatic merging processing module, characterized in that: The common source code management server includes a code base operation module, a code base branch and a code base event notification module. The code base branch automatic merge processing module includes a code base event monitoring module, a code synchronization rule configuration module, a code base event processing module and a branch automatic merge command generation module.
2. The source code management device for automatically merging code branches in a multi-branch development scenario according to claim 1, characterized in that: The code base operation module is used to process normal user operations.
3. The source code management device for automatically merging code branches in a multi-branch development scenario according to claim 2, characterized in that: The user operations specifically include downloading code, submitting code, and creating branches.
4. The source code management device for automatically merging code branches in a multi-branch development scenario according to claim 1, characterized in that: The code base event monitoring module is used to subscribe to and monitor code base events.
5. The source code management device for automatically merging code branches in a multi-branch development scenario according to claim 1, characterized in that: The code synchronization rule configuration module is used to configure the rules for automatic synchronization of codes between different branches.
6. The source code management method for automatically merging code branches in a multi-branch development scenario according to claim 1, characterized in that: The method steps are as follows: Step 1: The user first submits code to a branch of the code library; Step 2: After receiving the user's command, the code base operation module further operates on the branch; Step 3: The code base operation module generates a code base event and further transmits it to the code base event notification module; Step 4: The code base event monitoring module monitors the branch code submission event; Step 5: The code base event processing module further initiates a query request to the code synchronization rule configuration module to query and obtain the rule configuration content; Step 6: The codebase event processing module compares the rule configuration content obtained in step 5 with the event content obtained in step 4. If the event triggering condition in the rule configuration content does not match the event content obtained in step 4, the process ends; otherwise, the operation details in the rule configuration content obtained in step 5 are passed to the branch automatic merge command generation module; Step 7: The branch automatic merge command generation module further generates a branch code automatic merge command based on the operation details obtained in step 6; Step 8: The branch automatic merge command generation module further informs the code base operation module according to the command generated in step 7; Step 9: The code base operation module further operates the code base branch according to the command received in step 8 to complete the automatic synchronization of codes between different branches.
7. The source code management method for automatically merging code branches in a multi-branch development scenario according to claim 6, characterized in that: In the step 4, it is determined whether it is a branch code merging event. If not, the process ends; if so, the event content is notified to the code base event processing module and it is required to perform further processing.