Method and apparatus for managing branches
By automatically generating branch file directories and storing branch code on a remote server, the complex branch creation operation and low security issues in existing technologies are solved, achieving efficient and secure branch management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2020-04-23
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, both the hybrid front-end and back-end branching mode and the separate front-end and back-end branching mode require modification of configuration files when creating new branches. This operation is complex and carries the risk of manual intervention, affecting project development efficiency and security.
By responding to branch creation commands, sub-branches for the target business are created based on the main branch, and corresponding file directories are generated on the remote server to automatically store the branch code, avoiding the need to manually configure configuration directories.
It simplifies the process of creating new branches, reduces the possibility of configuration file errors, and improves the efficiency and security of project development.
Smart Images

Figure CN111522578B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium. Background Technology
[0002] Software development requires collaboration from the entire development team. The team creates branches and works on the code on those branches. To ensure more reliable software releases, these branches need to be properly maintained.
[0003] In related technologies, two branch maintenance schemes are provided: a hybrid front-end / back-end branching mode and a separate front-end / back-end branching mode. In the hybrid scheme, back-end developers are responsible for setting and configuring branches, while in the separate scheme, front-end developers are responsible for setting and configuring branches. However, both methods configure branch information through configuration files. If a new branch needs to be created, the development team needs to reconfigure the configuration file, which is complex and reduces project development efficiency. Furthermore, human intervention introduces uncertainty, potentially affecting project security. Summary of the Invention
[0004] This invention provides a branch management method, apparatus, and storage medium that can improve the efficiency and security of project development.
[0005] The technical solution of this invention is implemented as follows:
[0006] This invention provides a branch management method, including:
[0007] In response to a branch creation command, a sub-branch belonging to the target business of the project is created based on the main branch of the corresponding project.
[0008] In response to a code commit instruction, code input based on the sub-branch is received;
[0009] The received code is compiled to obtain the branch code corresponding to the sub-branch;
[0010] If it is determined that there is no file directory corresponding to the sub-branch, a file directory corresponding to the sub-branch is generated;
[0011] Store the branch code corresponding to the sub-branch in the file directory corresponding to the sub-branch.
[0012] This invention provides a branch management device, comprising:
[0013] The creation module is used to respond to branch creation instructions and create sub-branches corresponding to the target business of the project based on the main branch of the corresponding project.
[0014] The receiving module is configured to receive code input based on the sub-branch in response to a code submission command;
[0015] The compilation module is used to compile the received code to obtain the branch code corresponding to the sub-branch;
[0016] The generation module is used to generate the file directory corresponding to the sub-branch when it is determined that there is no file directory corresponding to the sub-branch.
[0017] The storage module is used to store the branch code corresponding to the sub-branch to the file directory of the corresponding sub-branch.
[0018] In the above scheme, the creation module is also used to create a sub-branch corresponding to the target business based on the branch name carried by the branch creation instruction;
[0019] The code corresponding to the main branch of the project is synchronized to the sub-branch of the target business to realize the creation of the sub-branch.
[0020] In the above scheme, the device further includes:
[0021] Add a module to receive the branch name of the sub-branch from the display interface based on the continuous integration platform;
[0022] Add the branch name to the continuous integration platform.
[0023] In the above scheme, the compilation module is further configured to generate code compilation instructions corresponding to the received code;
[0024] In response to the code compilation instructions, the received code is compiled through the continuous integration platform.
[0025] In the above scheme, the generation module is also used to obtain the branch name of the sub-branch;
[0026] If, based on the branch name of the sub-branch, it is determined that there is no file directory corresponding to the sub-branch on the remote server, a file directory corresponding to the sub-branch is generated on the remote server, and the name of the file directory is the same as the name of the sub-branch.
[0027] In the above scheme, the device further includes:
[0028] The synchronization module is used to synchronize the branch code corresponding to the sub-branch to the file directory of the corresponding main branch.
[0029] In the above scheme, the device further includes:
[0030] The first test module is used to respond to a modification instruction for user data on a target page and modify the user data on the target page to the branch name of the sub-branch;
[0031] In response to an access request for the target page, a page file retrieval request carrying the user data is sent to retrieve the page file of the target page from the folder corresponding to the branch name based on the user data;
[0032] Receive the page file and render the target page based on the page file.
[0033] In the above scheme, the device further includes:
[0034] The second testing module is used to respond to a modification instruction for user data on the target page and modify the user data on the target page to the branch name of the sub-branch;
[0035] In response to an access request for static resources, a static resource retrieval request is sent to determine the user data of the target page to which the static resource belongs, and the static resource is retrieved from the folder corresponding to the branch name based on the user data;
[0036] Receive the static resources and render the page based on the static resources.
[0037] In the above scheme, the device includes:
[0038] The toggle module is used to display branch switching options;
[0039] In response to a switching command triggered based on the branch switching option, the branch names of at least two selectable branches are presented, the branches being either a main branch or a sub-branch;
[0040] In response to a branch selection instruction, switch to the branch indicated by the instruction to perform code input based on the branch indicated by the instruction.
[0041] This invention provides an electronic device, comprising:
[0042] Memory, used to store executable instructions;
[0043] The processor, when executing executable instructions stored in the memory, implements the branch management method provided in this embodiment of the invention.
[0044] This invention provides a storage medium storing executable instructions, which, when executed by a processor, implement the branch management method provided in this invention.
[0045] The embodiments of the present invention have the following beneficial effects:
[0046] This invention generates a corresponding sub-branch file directory when it is determined that no such file directory exists; the branch code corresponding to the sub-branch is stored in the corresponding sub-branch file directory. In this way, since the sub-branch file directory is automatically generated, developers do not need to modify the configuration file during the process of adding a new branch, avoiding complex operations and reducing the possibility of errors when manually configuring the configuration file, thereby improving the efficiency and security of project development. Attached Figure Description
[0047] Figure 1 This is a flowchart illustrating the hybrid front-end and back-end branching mode provided by related technologies;
[0048] Figure 2 This is a flowchart illustrating the front-end and back-end separation branching model provided by related technologies;
[0049] Figure 3 This is an optional architecture diagram of the branch management system 100 provided in an embodiment of the present invention;
[0050] Figure 4 This is an optional structural schematic diagram of the electronic device provided in an embodiment of the present invention;
[0051] Figure 5 This is an optional flowchart illustrating the branch management method provided in this embodiment of the invention;
[0052] Figure 6 This is a schematic diagram of the branch creation interface provided in an embodiment of the present invention;
[0053] Figure 7 This is a schematic diagram of the code input interface provided in an embodiment of the present invention;
[0054] Figure 8 This is a schematic diagram of the code submission interface provided in an embodiment of the present invention;
[0055] Figure 9 This is a schematic diagram of the code submission interface provided in an embodiment of the present invention;
[0056] Figure 10 This is a schematic diagram of the display interface of the QCI client provided in an embodiment of the present invention;
[0057] Figure 11 This is a schematic diagram of the display interface of the QCI client provided in an embodiment of the present invention;
[0058] Figure 12 This is a schematic diagram of the display interface of the QCI client provided in an embodiment of the present invention;
[0059] Figure 13This is a schematic diagram of the cookie modification interface provided in an embodiment of the present invention;
[0060] Figure 14 This is a schematic diagram of the process for accessing the homepage provided in an embodiment of the present invention;
[0061] Figure 15 This is a schematic diagram of the homepage interface provided in an embodiment of the present invention;
[0062] Figure 16 This is a flowchart illustrating the static resources provided in an embodiment of the present invention;
[0063] Figure 17 This is a schematic diagram of the branch switching interface provided in an embodiment of the present invention;
[0064] Figure 18 This is a schematic diagram of an optional architecture for the branch management system provided in an embodiment of the present invention;
[0065] Figure 19 This is an optional flowchart illustrating the branch management method provided in this embodiment of the invention;
[0066] Figure 20 This is an optional flowchart illustrating the branch management method provided in this embodiment of the invention;
[0067] Figure 21 This is a schematic diagram of an optional structure of the branch management device provided in an embodiment of the present invention. Detailed Implementation
[0068] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on the present invention. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0069] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0070] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of the invention described herein can be implemented in an order other than that illustrated or described herein.
[0071] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to limit the invention.
[0072] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0073] Before providing a further detailed description of the embodiments of the present invention, the nouns and terms involved in the embodiments of the present invention will be explained, and the nouns and terms involved in the embodiments of the present invention shall be interpreted as follows.
[0074] 1) In response to, used to indicate the conditions or states on which the operation performed depends. When the conditions or states on which it depends are met, one or more operations performed may be performed in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations are performed.
[0075] 2) Branches are independent code environments used by developers to develop different business functions at the same time and conduct collaborative testing with testers; they enable testing of independent business functions and ensure that business functions do not affect each other.
[0076] 3) Nginx refers to open-source web service and proxy service software that supports high performance and high concurrency. It is also an IMAP / POP3 / SMTP proxy server. It uses a non-linear, event-driven architecture and is often used for load balancing, HTTP caching, or reverse proxying.
[0077] 4) QCI, or Quick Continuous Integration, is a rapid continuous integration system that focuses on process integration, data connection, and automated integration on the basis of building integration. It provides integrated continuous integration and continuous interaction platform integration services, that is, the code is compiled and sent to the corresponding folder on the target server.
[0078] 5) Cookies, or browser cookies, are small pieces of data sent from a website and stored on a user's computer by the user's web browser while the user is browsing. They are a reliable mechanism for websites to remember state information (such as items added to a shopping cart in an online store) or record user browsing activities (including clicking specific buttons, logging in, or recording previously visited pages). They can also be used to remember any information that the user has previously entered in form fields, such as name, address, password, and credit card number.
[0079] To achieve branch management, two solutions are provided in related technologies: the front-end and back-end hybrid branching mode and the front-end and back-end separate branching mode.
[0080] 1) The front-end and back-end hybrid branching mode is where back-end developers configure branches through configuration files. Figure 1 This is a flowchart illustrating the hybrid front-end and back-end branching model provided by related technologies. See [link / reference]. Figure 1 When a user triggers a page request, the browser retrieves the cookie stored in the browser based on the page request, sends the page request carrying the cookie to Apache, and after Apache's response, the backend code determines the file directory of the corresponding branch based on the value of the cookie, retrieves the template to be displayed from the determined file directory, and loads the data.
[0081] The branches and their corresponding file directories are configured through a configuration file. This means the branch names and number are fixed. Adding a new branch requires backend developers to modify the configuration file. When frontend developers need to add a new branch, they must communicate with the backend developers so they can modify the configuration file accordingly. Furthermore, since the mapping between cookies and file directories is determined by the backend code, backend developers also need to modify the backend code to accurately determine the file directories for the corresponding branches.
[0082] Therefore, the hybrid front-end and back-end branching model has the following problems:
[0083] 1. Front-end developers need to configure test branches for back-end developers, which involves some communication costs.
[0084] 2. The branch names are hardcoded, which results in a fixed number of branches, making it difficult to expand.
[0085] 3. Adding a branch requires modifying the configuration file, which is cumbersome and carries the risk of manual intervention.
[0086] 2) The front-end and back-end separation branch mode is where front-end developers configure branches through configuration files. Figure 2 This is a flowchart illustrating the front-end and back-end separation branching model provided by related technologies. See [link / reference]. Figure 2 When a user triggers a resource request, the browser retrieves the cookie stored in the browser based on the page request and sends the page request carrying the cookie to the Nginx server to request static resources. Nginx determines the file directory corresponding to the cookie value based on the Nginx configuration file and retrieves the required static resources from the determined file directory.
[0087] The branches and their corresponding file directories are configured through a configuration file. This means the branch names and number are fixed; adding a new branch requires the front-end developer to modify the configuration file. Furthermore, since the mapping between cookies and file directories is determined by the Nginx configuration file, the front-end developer also needs to modify the Nginx configuration file accordingly to accurately determine the file directory for the corresponding branch. Here, the branch names in the configuration file can be hardcoded or follow certain naming rules.
[0088] Therefore, the front-end and back-end separation branching model has the following problems:
[0089] 1. The branch names are hardcoded, which results in a fixed number of branches, making it difficult to expand.
[0090] 2. Branch names are not fixed, but they need to follow certain naming rules and are not easy to expand.
[0091] 3. Adding a branch requires modifying the configuration file, which is cumbersome and carries the risk of manual intervention.
[0092] Based on this, a branch management method according to an embodiment of the present invention is proposed to at least solve the above-mentioned problems in the related art, which will be described in detail below.
[0093] See Figure 3 , Figure 3 This is an optional architecture diagram of the branch management system 100 provided in an embodiment of the present invention. In order to support an instance application, the terminal (terminal 400-1 and terminal 400-2 are shown as examples) connects to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0094] A branch management client can be installed on the terminal, allowing the corresponding user to perform functions such as data transfer and message interaction. The user corresponding to the terminal can be any user from any project, and can be a member of the development team for that project. This user can use the client on the terminal to perform code development, branch creation, code commit, branch merging and destruction, and code deployment operations.
[0095] The terminal is used to respond to a branch creation command, create a sub-branch corresponding to the target business of the project based on the main branch of the corresponding project; respond to a code commit command, receive code input based on the sub-branch; compile the received code to obtain the branch code corresponding to the sub-branch; if it is determined that there is no file directory corresponding to the sub-branch, generate the file directory corresponding to the sub-branch in the server 200; and store the branch code corresponding to the sub-branch in the file directory corresponding to the sub-branch in the server 200.
[0096] Server 200 is used to store the file directories and corresponding branch code for each branch.
[0097] In practical applications, a server can be a single server configured to support various services, or it can be configured as a server cluster; a terminal can be a variety of user terminals such as smartphones, tablets, and laptops, or it can be any combination of two or more of these data processing devices or other data processing devices, such as wearable computing devices, personal digital assistants (PDAs), desktop computers, cellular phones, media players, navigation devices, game consoles, televisions, or these data processing devices or other data processing devices.
[0098] The electronic device implementing the branch management method of this invention will now be described. See also Figure 4 , Figure 4 This is an optional structural schematic diagram of the electronic device provided in an embodiment of the present invention. Figure 4 The illustrated electronic device includes at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components of the electronic device are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 4 The general labeled all buses as Bus System 440.
[0099] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0100] User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0101] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.
[0102] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this embodiment is intended to include any suitable type of memory.
[0103] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0104] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;
[0105] The network communication module 452 is used to reach other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.
[0106] Presentation module 453 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 associated with user interface 430 (e.g., a display screen, a speaker, etc.).
[0107] The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.
[0108] In some embodiments, the apparatus provided in this invention can be implemented in software. Figure 4 A branch management device 455 stored in memory 450 is shown. It can be software in the form of programs and plug-ins, including the following software modules: creation module 4551, receiving module 4552, compilation module 4553, generation module 4554 and storage module 4555. These modules are logical and can therefore be arbitrarily combined or further split according to the functions implemented.
[0109] The functions of each module will be explained below.
[0110] In other embodiments, the branch management device provided in this invention can be implemented in hardware. For example, the branch management device provided in this invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the branch management method provided in this invention. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0111] The branch management method provided in this invention will be described in conjunction with exemplary applications and implementations of the terminal provided in this embodiment.
[0112] See Figure 5 , Figure 5 This is an optional flowchart illustrating the branch management method provided in this embodiment of the invention, which will be combined with... Figure 5 The steps shown are explained.
[0113] Step 501: In response to the branch creation command, the terminal creates a sub-branch corresponding to the target business of the project, based on the main branch of the corresponding project.
[0114] Here, the main branch is the master branch, which is the default branch and the core branch for all development activities. All outputs from development activities are ultimately reflected in the code on the master branch. The master branch should contain code that is ready to be deployed in a production environment. When development activities conclude and a new deployable version of the code is generated, the code on the master branch will be updated. Each update also has a corresponding version number tag.
[0115] When developing a project, developers should complete the work on other branches, such as creating corresponding sub-branches based on the business logic to be developed, completing the development on the corresponding sub-branches, and then merging them into the main branch.
[0116] In practice, developers can use Git to create sub-branches belonging to the project's target business logic to achieve the development of that target project. Git is an open-source distributed version control system used to handle projects of any size, agilely and efficiently. Because Git branches are managed by pointers, creating, switching, merging, and deleting branches is very fast, making it ideal for developing large projects.
[0117] In practical applications, developers can arbitrarily assign branch names to sub-branches according to their needs, and then enter the `git branch` command through the Git command input interface to trigger the branch creation instruction. Git responds to the branch creation instruction and creates the corresponding sub-branch for the target business. For example, if the branch name to be created is `branch_a`, then the corresponding creation command is `git branch branch_a`.
[0118] In some embodiments, after creating a sub-branch for the target business, it is necessary to switch to the newly created sub-branch so that developers can work on the project on that branch. In practice, this can be achieved by entering the `git checkout` command in the Git command prompt. For example, to switch to the `branch_a` branch, you can enter the command `git checkout branch_a`.
[0119] In some embodiments, developers can enter the `git checkout -b` command through the Git command input interface to trigger branch creation and branch switching commands. In other words, the `git checkout -b` command is equivalent to the `git branch` and `git checkout` commands. In response to the branch creation and branch switching commands, Git first creates a sub-branch corresponding to the target business and then switches to the sub-branch corresponding to the target business.
[0120] For example, Figure 6 A schematic diagram of the interface for branch creation provided in this embodiment of the invention is shown below. Figure 6 In step 601, the developer enters the command `git checkout -b branch_a` to trigger branch creation and branch switching commands. Git creates a branch_a based on the master branch and switches to the branch_a branch.
[0121] In some embodiments, the terminal can create a sub-branch corresponding to the target service in the following ways: in response to the branch creation instruction, the sub-branch corresponding to the target service is created based on the branch name carried by the branch creation instruction; the code corresponding to the main branch of the corresponding project is synchronized to the sub-branch of the target service to realize the creation of the sub-branch.
[0122] In practice, the terminal needs to copy the code corresponding to the main branch to the sub-branch of the target business so that developers can modify the code based on it.
[0123] In some embodiments, after developers complete project development on a sub-branch corresponding to the target business, they enter a commit command through Git's command input interface to submit the code to the local repository. Git receives the entered commit command and stores the code based on that sub-branch in the local repository. Here, the commit command to submit the code to the local repository can be the `git commit` command.
[0124] In practice, when using the `git commit` command, Git generates a 40-bit hash value in the local repository. This hash value is also called the commit-id. The commit-id is very useful when rolling back versions. It is like a snapshot, which can be returned to at any time in the future by combining it with the `git reset` command.
[0125] In some embodiments, when entering the command to commit code to the local repository, a description parameter can be included to provide a brief description of the committed code. Here, the command to commit code to the local repository can be `git commit -am 'message'`, where `message` is the statement we use to briefly describe this commit.
[0126] Taking the modification of project copyright information as an example, Figure 7 This is a schematic diagram of the code input interface provided in an embodiment of the present invention. See also: Figure 7 The branch name 701 was added after the registration information; Figure 8 This is a schematic diagram of the code submission interface provided in an embodiment of the present invention. See [link / reference] Figure 8Git receives the command `git commit -am 'Add branch information to registry'` and commits the modified code to the local repository, along with a description of the code.
[0127] Step 502: In response to the code commit instruction, receive code based on sub-branch input.
[0128] Here, the code commit command is used to instruct the user to push the entered code to the remote server. In practice, this can be triggered by entering the `git push` command in the Git command prompt.
[0129] Figure 9 This is a schematic diagram of the code submission interface provided in an embodiment of the present invention. See [link / reference] Figure 9 Git receives the input git push command 901, triggering the code commit instruction.
[0130] In some embodiments, before receiving code input based on a sub-branch in response to a code commit instruction, the method further includes: receiving the sub-branch name input through a display interface of a continuous integration platform; and adding the branch name to the continuous integration platform.
[0131] Here, the continuous integration platform can be QCI. Developers can add the newly created sub-branch to QCI by entering its name through the QCI client's interface. Then, when a user triggers the code commit by entering the `git push` command in Git's command prompt, Git sends the code to QCI, which receives the code based on the sub-branch input.
[0132] Figure 10 This is a schematic diagram of the display interface of the QCI client provided in an embodiment of the present invention. See also: Figure 10 In the QCI client's display interface, enter branch_a in the corresponding input box to add branch_a to the QCI platform.
[0133] Step 503: Compile the received code to obtain the branch code corresponding to the sub-branch.
[0134] Here, compilation refers to converting the source code entered by the developer into a binary language that the computer can recognize; that is, the branch code corresponding to the sub-branch is the compiled code.
[0135] In some embodiments, the terminal may compile the received code in the following ways: based on the received code, generate code compilation instructions for the corresponding code; in response to the code compilation instructions, compile the received code through a continuous integration platform.
[0136] In practice, Git sends the code to QCI. After receiving the code based on the sub-branch input, QCI automatically generates the corresponding code compilation instructions and compiles the received code.
[0137] Figure 11 This is a schematic diagram of the display interface of the QCI client provided in an embodiment of the present invention. See also: Figure 11 When QCI receives input code, it automatically compiles the received code.
[0138] Step 504: If it is determined that the file directory of the corresponding sub-branch does not exist, generate the file directory of the corresponding sub-branch.
[0139] During implementation, after compiling the code, QCI needs to store the compiled code in the corresponding sub-branch's file directory on the remote server. If the corresponding sub-branch's file directory does not exist on the remote server, it needs to be generated. Here, when QCI determines that the corresponding sub-branch's file directory does not exist on the remote server, it will automatically generate the corresponding file directory.
[0140] In some embodiments, if a file directory corresponding to the sub-branch exists, the branch code corresponding to the sub-branch can be directly stored in the file directory of the corresponding sub-branch. It should be noted that, typically, when the branch code corresponding to the sub-branch is first pushed to the remote server after its creation, the file directory of the corresponding sub-branch does not exist on the remote server. Here, the remote server is either a DEV server or an OA server.
[0141] In some embodiments, the terminal can generate the file directory of the corresponding sub-branch in the following way: obtain the branch name of the sub-branch; based on the branch name of the sub-branch, if it is determined that the file directory of the corresponding sub-branch does not exist on the remote server, generate the file directory of the corresponding sub-branch on the remote server, and the name of the file directory is the same as the name of the sub-branch.
[0142] Here, the directory name of each branch's file directory is the same as the branch name. This makes it more convenient to find the file directory of the corresponding branch, without the need to store the correspondence between branches and file directories separately.
[0143] In practice, the names of the file directories of each branch existing on the remote server are matched with the branch names of the newly created sub-branches. If a file directory with the same name as the sub-branch exists, it means that the file directory of the corresponding sub-branch exists on the remote server; otherwise, it means that the file directory of the corresponding sub-branch does not exist, and the file directory of the corresponding sub-branch needs to be created.
[0144] Step 505: Store the branch code corresponding to the sub-branch in the corresponding sub-branch file directory.
[0145] In practice, based on the correspondence between sub-branches and file directories, the file directory of the corresponding sub-branch is determined, and the branch code is stored in the corresponding sub-branch file directory. When the name of the file directory is the same as the branch name of the sub-branch, the branch name of the sub-branch can be obtained, and the file directory with the same name can be matched according to the branch name. The branch code corresponding to the sub-branch is then stored in the determined file directory.
[0146] Figure 12 This is a schematic diagram of the display interface of the QCI client provided in an embodiment of the present invention. See also: Figure 12 After storing the branch code corresponding to the sub-branch to the corresponding sub-branch's file directory, the QCI client's display interface will show the storage result.
[0147] In some embodiments, after storing the branch code corresponding to the sub-branch in the file directory of the corresponding sub-branch, the branch code corresponding to the sub-branch can also be synchronized to the file directory of the corresponding main branch.
[0148] In practice, the code of the sub-branch is synchronized to the file directory of the corresponding main branch. In this way, even if the tester has not set up the corresponding sub-branch, the code update can be determined through the main branch.
[0149] In some embodiments, after storing the branch code corresponding to the sub-branch in the sub-branch's file directory, testers can test the branch code corresponding to the sub-branch.
[0150] In some embodiments, testing of branch code can be implemented in the following ways: in response to a modification instruction for user data of the target page, the user data of the target page is modified to the branch name of the sub-branch; in response to an access request for the target page, a page file retrieval request carrying user data is sent to retrieve the page file of the target page from the folder with the corresponding branch name based on the user data; the page file is received to present the target page based on the page file.
[0151] In practice, user data refers to cookies. Testers can modify the cookie data on the target page to test branch code. Specifically, they modify the target page's cookie to the name of the sub-branch to be tested, then enter the target page's domain name in the browser interface and send an access request. The browser generates a page file retrieval request carrying the cookie and sends this request to the Nginx server. Since the cookie contains the sub-branch's name, the Nginx server can determine the corresponding file directory based on the branch name and retrieve the appropriate page file from that directory.
[0152] Let's take accessing the homepage as an example. Figure 13 This is a schematic diagram of the cookie modification interface provided in an embodiment of the present invention. See also: Figure 13 Change the cookie to branch_a (key: feature_branch, value: branch_a), where branch_a is the name of the sub-branch to be tested.
[0153] Figure 14 This is a schematic diagram of the process of accessing the homepage provided in an embodiment of the present invention. See also: Figure 14 First, the tester enters the domain name of the page to be accessed, https: / / www.xxx.com / index, into their browser. After receiving the entered domain name, the browser sends a request to the Nginx server to retrieve the page file, which includes cookies. The Nginx server, based on the configuration file for accessing the homepage, locates the corresponding sub-branch directory on the remote server, namely the branch_a directory, and retrieves the page file, index.html, from the branch_a directory. After obtaining the index.html file, the Nginx server returns it to the browser so that the browser can render the homepage based on this file.
[0154] The configuration information in the Nginx server's configuration file regarding accessing the homepage is as follows: Figure 14 As shown in Figure 1401, Nginx determines the corresponding file directory directly based on the feature_branch variable. In other words, the branch name is not hardcoded in the configuration file. Thus, after adding a sub-branch, there is no need to modify the configuration file in the Nginx server, which simplifies the operation in the testing process and improves the work efficiency of testers.
[0155] Figure 15 This is a schematic diagram of the homepage interface provided in an embodiment of the present invention. See also: Figure 151501 represents the modified registration information. A branch name has been added after the registration information, meaning that the code modified in the sub-branch is reflected on the homepage.
[0156] In addition to template resources, the page also includes static resources. After obtaining index.html, the browser will then request static resources such as js and css, for example, the index.css file. In some embodiments, branch code testing can be implemented in the following ways: In response to a modification instruction for user data on the target page, the user data on the target page is modified to the branch name of the sub-branch; In response to a request to access static resources, a static resource retrieval request is sent to determine the user data of the target page to which the static resources belong, and the static resources are retrieved from the folder with the corresponding branch name based on the user data; The static resources are received to perform page rendering based on the static resources.
[0157] In practice, the browser enters the domain name of the static resource and sends an access request for the static resource of the target page. The browser generates a static resource retrieval request and sends the page file retrieval request to the Nginx server. Nginx determines the corresponding file directory based on the cookie of the page to which the static resource belongs and retrieves the corresponding page file from the file directory.
[0158] Figure 16 This is a flowchart illustrating the static resources provided in an embodiment of the present invention. See also... Figure 16 First, the tester enters the domain name of the desired static resource, https: / / www.xxx.com / index.css, into their browser. Upon receiving the domain name, the browser sends the corresponding resource retrieval request to the Nginx server. The Nginx server, based on the configuration file for the static resource, locates the corresponding sub-branch directory (branch_a) on the remote server and retrieves the static resource, i.e., the index.css file, from the branch_a directory. After obtaining the index.css file, the Nginx server returns it to the browser so that the browser can render the page based on this file.
[0159] The configuration information in the static resource configuration file of the Nginx server is as follows: Figure 16As shown in section 1601, Nginx directly retrieves the corresponding cookie and then determines the appropriate file directory based on the cookie. This means the branch name isn't hardcoded in the configuration file. Therefore, after adding a sub-branch, there's no need to modify the Nginx server's configuration file, simplifying the testing process and improving tester efficiency. The Nginx server automatically performs redirection; the requested ` / feature / index.css` is automatically redirected to ` / branch_a / index.css`.
[0160] It should be noted that all static resources are requested in the same way, that is, the same mechanism is used for static JavaScript resources.
[0161] In some embodiments, a convenient branch switching page is also provided for developers to use: presenting branch switching options; in response to a switching instruction triggered based on the branch switching options, presenting the branch names of at least two selectable branches, the branches being the main branch or sub-branch; and in response to a branch selection instruction, switching to the branch indicated by the instruction to enter code based on the branch indicated by the instruction.
[0162] In practice, when a developer clicks the branch switching option, the terminal displays all the branch names on the remote server. The developer can click the branch name of the branch they want to select to trigger the branch selection command. Git then switches to the branch selected by the developer, allowing the developer to directly develop the project on that branch.
[0163] For example, Figure 17 This is a schematic diagram of the branch switching interface provided in an embodiment of the present invention. See also: Figure 17 The graphical interface displays the current branch 1701 and the branch switching function item 1702. When the developer clicks on the branch switching function item 1702, the terminal displays the names of all existing branches in the graphical interface, such as... Figure 17 As shown in 1703, developers can click the branch name of the branch they want to select and click the OK switch button 1704 to trigger the branch selection command. Upon receiving the branch selection command, the system switches to the branch selected by the developer and displays a success message in the graphical interface.
[0164] In this embodiment of the invention, when it is determined that there is no file directory for the corresponding sub-branch, a file directory for the corresponding sub-branch is generated; the branch code corresponding to the sub-branch is stored in the file directory of the corresponding sub-branch; thus, since the file directory of the sub-branch is automatically generated, developers do not need to modify the configuration file during the process of adding a new branch, avoiding complex operations, reducing the possibility of errors when manually configuring the configuration file, and improving the efficiency and security of project development.
[0165] The following continues to describe the branch management method provided in the embodiments of the present invention. Figure 18 This is a schematic diagram of an optional architecture for the branch management system provided in an embodiment of the present invention. See also... Figure 18 The branch management system includes Git, QCI, and remote servers.
[0166] Figure 19 This is an optional flowchart illustrating the branch management method provided in this embodiment of the invention, combined with... Figure 18 and Figure 19 The branch management method provided in the embodiments of the present invention.
[0167] Step 1901: In response to the branch creation command, create branch_a based on the master branch and switch to branch_a.
[0168] See Figure 6 Developers enter the command `git checkout -b branch_a` to trigger branch creation and branch switching commands. Git creates the branch_a branch based on the master branch and switches to the branch_a branch.
[0169] Step 1902: Receive code based on branch_a input.
[0170] See Figure 7 A branch name was added after the registration information.
[0171] Step 1903: In response to the first commit command, Git stores the entered code in the local repository.
[0172] See Figure 8 When Git receives the command `git commit -am 'Add branch information to registry'`, it commits the entered code to the local repository and provides a description of the code.
[0173] Step 1904: QCI receives the branch name of the input branch_a from the display interface.
[0174] Step 1905: QCI adds the branch name of branch_a.
[0175] See Figure 10 In the QCI client's display interface, enter branch_a in the corresponding input box to add branch_a to the QCI platform.
[0176] Step 1906: In response to the second commit command, Git commits the entered code to QCI.
[0177] See Figure 9 When Git receives the input `git push` command, it triggers the second commit instruction.
[0178] Step 1907: QCI compiles the received code to obtain the branch code corresponding to the sub-branch.
[0179] See Figure 11 When QCI receives input code, it automatically compiles the received code.
[0180] Step 1908: If it is determined that a file directory named branch_a does not exist, create the branch_a directory on the remote server.
[0181] Step 1909: Store the branch code corresponding to the sub-branch in a file directory named branch_a.
[0182] Step 1910: Synchronize the branch code corresponding to the sub-branch to the file directory named master.
[0183] After storing the branch code on a remote server, testers can then test that branch code. Figure 20 This is a flowchart illustrating the branch management method provided in an embodiment of the present invention. See also... Figure 20 After performing step 1910, the following steps 1911 to 1916 can also be performed:
[0184] Step 1911: In response to the modification instruction for the cookie, change the cookie value to branch_a.
[0185] Step 1912: Received the domain name of the homepage https: / / www.xxx.com / index.
[0186] Step 1913: Generate a page file retrieval request carrying cookies and send it to the Nginx server.
[0187] Step 1914: The Nginx server locates the directory named branch_a on the remote server based on the configuration file about accessing the homepage.
[0188] Step 1915: The Nginx server retrieves the index.html file from the directory named branch_a.
[0189] Step 1916: Return the index.html file to the browser.
[0190] Step 1917: The browser displays the homepage based on the index.html file.
[0191] The following will describe an exemplary application of the embodiments of the present invention in a practical application scenario.
[0192] In practice, when front-end developers need to develop a project, they need to create a new branch for the business logic they want to develop, and then develop the project on the created branch.
[0193] First, developers can arbitrarily name a branch according to their needs and then enter the `git branch` command through the Git command prompt to trigger the branch creation instruction. Git responds to the branch creation instruction and creates a sub-branch corresponding to the target business. For example, if the branch name to be created is `branch_a`, then the corresponding creation command is `git branch branch_a`.
[0194] After creating a branch, you need to switch to it so that front-end developers can work on the project. In practice, you can use the Git command prompt to enter the `git checkout` command to trigger the branch switch. For example, to switch to the `branch_a` branch, you can enter the command `git checkout branch_a`.
[0195] Here, front-end developers can enter the command `git checkout -b` to perform both creation and switching. For example, see... Figure 6 The front-end developer enters the command `git checkout -b branch_a`, and Git creates a branch_a based on the master branch and switches to the branch_a branch.
[0196] Next, developers can work on the created branch and commit code. For example, see... Figure 7 A branch name has been added after the registration information; see [link / reference]. Figure 8 When Git receives the command `git commit -am 'Add branch information to registry'`, it commits the modified code to the local repository.
[0197] Then, the front-end developer adds the branch name to QCI by entering the branch name of the newly created sub-branch through the QCI client's display interface. See also Figure 10 In the QCI client's display interface, enter branch_a in the corresponding input box to add branch_a to the QCI platform.
[0198] After adding branch_a to the QCI platform, front-end developers can enter code and publish commands through the Git command-line interface. See [link / reference]. Figure 9 When Git receives the `git push` command, it triggers the code release instruction. At this point, Git sends the code to QCI, which automatically compiles and releases the code upon receiving it.
[0199] See Figures 11-12 When QCI receives the input code, it automatically compiles and publishes the received code, and displays the processing results of each step on the display interface.
[0200] Here, the code release process is explained in detail. In actual implementation, after QCI compiles the code, it checks whether the OA / DEV server contains a directory with the branch name corresponding to the currently released code. Taking branch name "branch_a" as an example, QCI will check if the "branch_a" directory exists on the OA / DEV server. If it does not exist, it will create the "branch_a" directory and then store the compiled code in that directory; if it exists, it will directly store the compiled code in that directory.
[0201] In practice, after storing the compiled code in the file directory of the corresponding branch, the compiled code will also be synchronized to the master directory, which is the file directory of the main branch, so that testers can obtain the updated code even if no branch is set.
[0202] After the code is released, testers can test it. In practice, testers modify cookies in the webpage to respond, as shown in [reference needed]. Figure 13 The code for branch_a needs to be tested by changing the cookie to branch_a (key: feature_branch, value: branch_a).
[0203] Here, we will explain how to obtain resources from template resources and static resources respectively.
[0204] 1) Template resources. See [link / reference] Figure 14First, the tester enters the domain name of the page to be accessed, https: / / www.xxx.com / index, into their browser. After receiving the entered domain name, the browser sends a request to the Nginx server, carrying a cookie, to retrieve the page file. The Nginx server, based on the configuration file for accessing the homepage, searches for the corresponding sub-branch directory on the remote server, namely the branch_a directory, and retrieves the page file, index.html, from the branch_a directory. After obtaining the index.html file, the Nginx server returns the index.html file to the browser.
[0205] The configuration information in the Nginx server's configuration file regarding accessing the homepage is as follows: Figure 14 As shown in Figure 1401, Nginx determines the corresponding file directory directly based on the feature_branch variable. In other words, the branch name is not hardcoded in the configuration file. Thus, after adding a sub-branch, there is no need to modify the configuration file in the Nginx server, which simplifies the operation in the testing process and improves the work efficiency of testers.
[0206] 2) Static Resources. After retrieving index.html, the browser will then request static resources such as JS and CSS files, including the index.css file. See also... Figure 16 The browser sends a request to the Nginx server to retrieve static resources. The Nginx server then uses the configuration file for static resources to locate the corresponding sub-branch directory on the remote server, i.e., the branch_a directory, and retrieves the static resource, i.e., the index.css file, from the branch_a directory.
[0207] The configuration information in the static resource configuration file of the Nginx server is as follows: Figure 16 As shown in section 1601, Nginx directly retrieves the corresponding cookie and then determines the appropriate file directory based on the cookie. This means the branch name isn't hardcoded in the configuration file. Therefore, after adding a sub-branch, there's no need to modify the Nginx server's configuration file, simplifying the testing process and improving tester efficiency. The Nginx server automatically performs redirection; the requested ` / feature / index.css` is automatically redirected to ` / branch_a / index.css`.
[0208] This invention also provides a convenient branch switching page for backend personnel: when a developer clicks the branch switching option, the terminal displays all the branch names on the remote server. The developer can click the branch name of the branch to be selected to trigger the branch selection command and switch to the branch selected by the developer. In this way, the developer can directly carry out project development on that branch.
[0209] For example, see Figure 17 The graphical interface displays the current branch 1701 and the branch switching function item 1702. When the developer clicks on the branch switching function item 1702, the terminal displays the names of all existing branches in the graphical interface, such as... Figure 17 As shown in 1703, developers can click the branch name of the branch they want to select and click the OK switch button 1704 to trigger the branch selection command. Upon receiving the branch selection command, the system switches to the branch selected by the developer and displays a success message in the graphical interface.
[0210] The present invention has the following beneficial effects:
[0211] 1. The configuration complexity of branches is greatly simplified. Through the use of Nginx and QCI, dynamically added branches can automatically generate corresponding branch directories with zero configuration, which greatly reduces the uncertainty caused by manual operation, thereby improving the efficiency and security of project development.
[0212] 2. Front-end developers have complete control over branches and can create convenient branch switching pages for back-end developers. This makes business development and testing more convenient and flexible, and significantly reduces communication costs with testers. The ability to implement unlimited branches reduces the coupling between sub-business functions, facilitating testing and improving project reliability and stability.
[0213] The following describes an exemplary structure of the branch management device 455 provided in this embodiment of the invention as a software module. Figure 21 This is a schematic diagram of an optional structure of the branch management device provided in an embodiment of the present invention, such as... Figure 21 As shown, the branch determination device 455 provided in this embodiment of the invention includes:
[0214] The creation module 4551 is used to respond to the branch creation command and create a sub-branch corresponding to the target business of the project based on the main branch of the corresponding project.
[0215] Receiving module 4552 is used to receive code input based on the sub-branch in response to a code submission command;
[0216] The compilation module 4553 is used to compile the received code to obtain the branch code corresponding to the sub-branch;
[0217] The generation module 4554 is used to generate the file directory corresponding to the sub-branch when it is determined that there is no file directory corresponding to the sub-branch.
[0218] Storage module 4555 is used to store the branch code corresponding to the sub-branch to the file directory corresponding to the sub-branch.
[0219] In some embodiments, the creation module 4551 is further configured to create a sub-branch corresponding to the target business based on the branch name carried by the branch creation instruction;
[0220] The code corresponding to the main branch of the project is synchronized to the sub-branch of the target business to realize the creation of the sub-branch.
[0221] In some embodiments, the apparatus further includes:
[0222] Add a module to receive the branch name of the sub-branch from the display interface based on the continuous integration platform;
[0223] Add the branch name to the continuous integration platform.
[0224] In some embodiments, the compilation module 4553 is further configured to generate code compilation instructions corresponding to the received code;
[0225] In response to the code compilation instructions, the received code is compiled through the continuous integration platform.
[0226] In some embodiments, the generation module 4554 is further configured to obtain the branch name of the sub-branch;
[0227] If, based on the branch name of the sub-branch, it is determined that there is no file directory corresponding to the sub-branch on the remote server, a file directory corresponding to the sub-branch is generated on the remote server, and the name of the file directory is the same as the name of the sub-branch.
[0228] In some embodiments, the apparatus further includes:
[0229] The synchronization module is used to synchronize the branch code corresponding to the sub-branch to the file directory of the corresponding main branch.
[0230] In some embodiments, the apparatus further includes:
[0231] The first test module is used to respond to a modification instruction for user data on a target page and modify the user data on the target page to the branch name of the sub-branch;
[0232] In response to a page file retrieval request for the target page, a page file retrieval request carrying the user data is sent to retrieve the page file of the target page from the folder corresponding to the branch name based on the user data;
[0233] Receive the page file and render the target page based on the page file.
[0234] In some embodiments, the apparatus further includes:
[0235] The second testing module is used to respond to a modification instruction for user data on the target page and modify the user data on the target page to the branch name of the sub-branch;
[0236] In response to a second request for static resources, a static resource retrieval request is sent to determine the user data of the target page to which the static resource belongs, and to retrieve the static resource from the folder corresponding to the branch name based on the user data;
[0237] Receive the static resources and render the page based on the static resources.
[0238] In some embodiments, the apparatus further includes:
[0239] The toggle module is used to display branch switching options;
[0240] In response to a switching command triggered based on the branch switching option, the branch names of at least two selectable branches are presented, the branches being either a main branch or a sub-branch;
[0241] In response to a branch selection instruction, switch to the branch indicated by the instruction to perform code input based on the branch indicated by the instruction.
[0242] This invention provides a storage medium storing executable instructions. When these executable instructions are executed by a processor, they cause the processor to execute the branch management method provided in this invention, for example... Figure 5 The method shown.
[0243] In some embodiments, the storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0244] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0245] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).
[0246] As an example, executable instructions can be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.
[0247] The above are merely embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of the present invention are included within the scope of protection of the present invention.
Claims
1. A branch management method, characterized in that, The method includes: In response to a branch creation command, a sub-branch belonging to the target business of the project is created based on the main branch of the corresponding project. In response to a code commit instruction, code input based on the sub-branch is received; The received code is compiled to obtain the branch code corresponding to the sub-branch; When the file directory corresponding to the sub-branch does not exist on the remote server, a file directory with the same name as the sub-branch is generated on the remote server without modifying the configuration file of the remote server. Store the branch code corresponding to the sub-branch in the file directory corresponding to the sub-branch; In response to a modification instruction for user data on a target page, the user data on the target page is modified to the branch name of the sub-branch; In response to a page file retrieval request for the target page, a page file retrieval request carrying the user data is sent to the remote server, so that the remote server determines the file directory corresponding to the sub-branch based on the branch name and retrieves the page file of the target page from the file directory; Receive the page file, and present the target page based on the page file.
2. The method as described in claim 1, characterized in that, The process of creating sub-branches corresponding to the target business of the project based on the main branch of the corresponding project includes: Based on the branch name carried by the branch creation command, create a sub-branch corresponding to the target business; The code corresponding to the main branch of the project is synchronized to the sub-branch of the target business to realize the creation of the sub-branch.
3. The method as described in claim 1, characterized in that, Before receiving code based on the sub-branch input in response to a code commit instruction, the method further includes: Receive the branch name of the sub-branch from the display interface based on the continuous integration platform; Add the branch name to the continuous integration platform.
4. The method as described in claim 1, characterized in that, The process of compiling the received code includes: Based on the received code, generate code compilation instructions corresponding to the code; In response to the code compilation instructions, the received code is compiled through the continuous integration platform.
5. The method as described in claim 1, characterized in that, The method further includes: The branch code corresponding to the sub-branch is synchronized to the file directory of the corresponding main branch.
6. The method as described in claim 1, characterized in that, The method further includes: In response to an access request for a static resource, a static resource retrieval request is sent to determine the user data of the target page to which the static resource belongs, and the static resource is retrieved from the file directory corresponding to the branch name based on the user data; Receive the static resources and render the page based on the static resources.
7. The method as described in claim 1, characterized in that, The method further includes: Present branch switching options; In response to a switching command triggered based on the branch switching option, the branch names of at least two selectable branches are presented, the branches being either a main branch or a sub-branch; In response to a branch selection instruction, switch to the branch indicated by the instruction to perform code input based on the branch indicated by the instruction.
8. A branch management device, characterized in that, The device includes: The creation module is used to respond to branch creation instructions and create sub-branches corresponding to the target business of the project based on the main branch of the corresponding project. The receiving module is configured to receive code input based on the sub-branch in response to a code submission command; The compilation module is used to compile the received code to obtain the branch code corresponding to the sub-branch; The generation module is used to generate a file directory with the same name as the sub-branch on the remote server without modifying the configuration file of the remote server when the file directory corresponding to the sub-branch does not exist on the remote server. The storage module is used to store the branch code corresponding to the sub-branch in the file directory corresponding to the sub-branch; The first test module is used to respond to a modification instruction for user data on a target page and modify the user data on the target page to the branch name of the sub-branch; In response to a page file retrieval request for the target page, a page file retrieval request carrying the user data is sent to the remote server, so that the remote server determines the file directory corresponding to the sub-branch based on the branch name and retrieves the page file of the target page from the file directory; Receive the page file, and present the target page based on the page file.
9. The apparatus according to claim 8, characterized in that, The creation module is also used to create a sub-branch corresponding to the target business based on the branch name carried by the branch creation instruction; The code corresponding to the main branch of the project is synchronized to the sub-branch of the target business to realize the creation of the sub-branch.
10. The apparatus according to claim 8, characterized in that, The device further includes: Add a module to receive the branch name of the sub-branch from the display interface based on the continuous integration platform; Add the branch name to the continuous integration platform.
11. The apparatus according to claim 8, characterized in that, The compilation module is also used to generate code compilation instructions corresponding to the received code; In response to the code compilation instructions, the received code is compiled through the continuous integration platform.
12. The apparatus according to claim 8, characterized in that, The device further includes: The synchronization module is used to synchronize the branch code corresponding to the sub-branch to the file directory of the corresponding main branch.
13. The apparatus according to claim 8, characterized in that, The device further includes: The second testing module is used to respond to access requests for static resources by sending a static resource retrieval request to determine the user data of the target page to which the static resource belongs, and to retrieve the static resource from the file directory corresponding to the branch name based on the user data. Receive the static resources and render the page based on the static resources.
14. The apparatus according to claim 8, characterized in that, The device further includes: The toggle module is used to display branch switching options; In response to a switching command triggered based on the branch switching option, the branch names of at least two selectable branches are presented, the branches being either a main branch or a sub-branch; In response to a branch selection instruction, switch to the branch indicated by the instruction to perform code input based on the branch indicated by the instruction.
15. An electronic device, characterized in that, include: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the branch management method according to any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that, It stores executable instructions for causing the processor to execute, thereby implementing the branch management method according to any one of claims 1 to 7.