CN111352651B - Code branch management method and device - Google Patents

Code branch management method and device Download PDF

Info

Publication number
CN111352651B
CN111352651B CN202010247066.6A CN202010247066A CN111352651B CN 111352651 B CN111352651 B CN 111352651B CN 202010247066 A CN202010247066 A CN 202010247066A CN 111352651 B CN111352651 B CN 111352651B
Authority
CN
China
Prior art keywords
branch
development
branches
code
codes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010247066.6A
Other languages
Chinese (zh)
Other versions
CN111352651A (en
Inventor
桑京
李卓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202010247066.6A priority Critical patent/CN111352651B/en
Publication of CN111352651A publication Critical patent/CN111352651A/en
Application granted granted Critical
Publication of CN111352651B publication Critical patent/CN111352651B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a code branch management method and a device, wherein the method comprises the following steps: during project development, acquiring codes from the development branches, and creating individual development branches; carrying out local integration test on the developed individual development branches; if the local integration test is passed, merging the codes of the personal development branches into the development branches, and carrying out system integration test on the development branches; if the system integration test is passed, acquiring codes from the development branch, creating a release branch, and performing user acceptance test on the release branch; and if the user acceptance test is passed, merging the codes of the issued branches into the main branches, and performing production and use on the codes of the main branches. The invention can simultaneously support a plurality of developers to simultaneously develop projects by allowing the individual development branches to be created, and can combine the codes of the developers to the development branches in time, thereby improving the timeliness of code combination, and detecting the code branches in time and improving the efficiency of code detection.

Description

Code branch management method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a code branch management method and apparatus.
Background
Currently, there are three types of code branch management methods, namely trunk-based definition (TBD), gitflow, and GitHub flow. The main development branch is suitable for agile small-scale team cooperation, and the robustness of the main code is kept through frequent combination; git flow is complex, the management requirement on characteristic branches is high, and code conflict is easy to occur if codes are submitted and combined according to an agreed rule; the GitHub flow needs thick agile consciousness, is similar to trunk development, emphasizes frequent submission and frequent combination, and is more suitable for professional groups such as open source communities and the like.
The method for managing the code branches of the trunk development is briefly described as follows:
when the 'backbone development' is adopted, the code is generally submitted to the head of the backbone, and all users are guaranteed to see the latest version of the same code. The "trunk development" avoids the trouble of merging branches. Most of the time, the publishing branch is a snapshot of the backbone at some point in time. Subsequent debugging and functional enhancements are committed to the backbone, and the commit to the issue branch if necessary. Since "branch development" is not employed, introducing new functionality typically uses switch control in the code. This avoids having to take another branch and also makes it easy to switch functions by configuration, and to switch back to an old function in case of a failure of a new function. And the old code is completely deleted after the new function is stable.
However, in actual development work, code management of single backbone development is not a big problem during project new establishment, but if a project enters maintenance period, the following problems are easily caused: in the continuous development of versions, time difference exists between project development and code testing, so that codes cannot be detected in time, and a stable and commercially available version cannot be released quickly.
The method for managing the branch of the Git Flow code is briefly described as follows:
git flow supports the following properties: 1. and (3) parallel development: the Git Flow can be developed in parallel with convenient realization. Each new function establishes a new feature branch (i.e., a feature branch) to be isolated from the completed function, and only when the new function is developed, the corresponding feature branch is merged into the develop branch. In addition, if you are developing a certain function and there is a new function to be developed, you only need to submit the code of the current feature, then create another feature branch and complete the new function development. Then, the previous feature branch is cut back, and the previous function development can be continuously completed; 2. and (3) collaborative development: the GitFlow also supports multi-person collaborative development because the changed code on each feature branch is only to allow a new feature to run independently. Meanwhile, people can easily know that everyone is dry; 3.
a release stage: when a new feature is developed, the new feature is merged into a develop branch, and the branch is mainly used for temporarily storing the content which is not released yet, so that if the new feature needs to be developed again, a new branch is only required to be created from the develop branch, and all the completed features can be contained; 4. support for emergency repairs: the GitFlow also contains a hot branch (thermal repair branch). This type of branch is created from a published tag and an urgent repair is made, and this urgent repair only affects the published tag and not the new feature you are developing.
But the feature branch model behind Gitflow has been shown many times in the journal to be a nuisance in production practice by St.Watcher (ThoughtWorks). Gitflow has the disadvantage of difficulty merging after the following versions are developed: the GitFlow emphasizes management and emphasizes multi-branch development, which causes integration lag, combination difficulty and influences continuous integration. Long-live feature branch is a common persistent commit reversal mode. This is because if a project has multiple branches that evolve independently of each other over long term, it is often necessary to wait until the last release to merge the code, which runs counter to the best practice of continued integration. If frequent merging can be done, then gitflow has no problem. One problem that often arises, however, is that many people begin to use Git to escape dire merging conflicts. Regardless of the source code management tool or mode used by the developer, once the developer has waited for a day or two to do the merge work, a large merge conflict may be encountered. If a developer has more than one person waiting to merge, there may be a serious bottleneck. Introducing patterns like Gitflow requires frequent merging to be successful. Behind the Gitflow is a feature branch model. Two of the most obvious benefits of feature branch are: one is that the codes between features are isolated and can be independently developed, constructed and tested; secondly, when the development period of feature is longer than the release period, the incomplete feature can be prevented from entering the production environment.
However, in the case of adhering to the continuous integration practice, the feature branch has the following problems: continuous integration encourages more frequent code integration and interaction, with conflicts resolved as early as possible, while feature branch's code isolation policy is deferring code integration as much as possible. The mischief caused by delayed integration appears for many times in the history of software development, each team writes own codes smoothly, but the problem is exposed when different teams perform joint debugging integration at last, so that the situation that the development team writes two-month codes, but the development team needs to take one month for integration, and the quality cannot be guaranteed occurs.
The method for managing the code branch of the GitHub Flow is briefly as follows: the scenario targeted by the GitHub Flow is a scenario where product codes are issued several times a day, solving small problems several times a day in an expeditious manner. The GitHub Flow has only a master branch (i.e., main branch) and feature branch, which is equivalent to merging the master branch and develop branch of the GitFlow (i.e., open branch) into one branch. The GitHub Flow is deployed continuously and safely at high speed through simple functions and rules in a deployment-centric development mode. In actual development, dozens of deployments are often implemented within one day, and supporting all of them is a sufficiently simple development process and complete automation.
However, when using Github Flow, there are limits to the size of the development team, preferably within 15-20 people.
In summary, currently, three mainstream code branch management methods are used for trunk-based development (TBD), gitflow, and GitHub flow. However, the trunk development has the problem that code detection is difficult to perform in time, the gitflow has the problem that code branches are difficult to merge in the project development era, and the GitHub flow has the problem that the number of developers is limited. Under the condition that the requirement of a large-scale enterprise on the code management intensity is gradually increased, a code management mode which can well solve the problems does not exist.
Disclosure of Invention
The embodiment of the invention provides a code branch management method, which is used for supporting multiple persons to simultaneously develop projects and timely detect codes and combine code branches, and comprises the following steps:
acquiring codes from the development branches, and creating individual development branches; the personal development branch is used for the development of the project locally by a developer;
carrying out local integration test on the developed individual development branches;
if the local integration test is passed, merging the codes of the personal development branches into the development branches, and carrying out system integration test on the development branches;
if the system integration test is passed, acquiring codes from the development branch, creating a release branch, and performing user acceptance test on the release branch;
and if the user acceptance test is passed, merging the code of the issued branch into the main branch.
The embodiment of the invention also provides a code branch management device, which is used for supporting a plurality of persons to simultaneously develop projects and timely detect codes and combine code branches, and comprises the following components:
the personal development branch creating module is used for acquiring codes from the development branches and creating personal development branches; the personal development branch is used for the development personnel to develop the project locally;
the local integrated test module is used for carrying out local integrated test on the individual development branches after the development is finished;
the system integration testing module is used for merging codes of the personal development branches into the development branches and carrying out system integration testing on the development branches if the local integration testing passes;
the user acceptance testing module is used for acquiring codes from the development branch if the system integration test is passed, creating a release branch and carrying out user acceptance testing on the release branch;
and the main branch merging module is used for merging the codes of the issued branches into the main branches and carrying out production use on the codes of the main branches if the user acceptance test passes.
The embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, and the computer readable storage medium stores a computer program for executing the method.
In the embodiment of the invention, codes are obtained from development branches, and individual development branches are created; the personal development branch is used for the development personnel to develop the project locally; carrying out local integration test on the developed individual development branches; if the local integration test is passed, merging the codes of the personal development branches into the development branches, and carrying out system integration test on the development branches; if the system integration test is passed, acquiring codes from the development branch, creating a release branch, and performing a user acceptance test on the release branch; if the user acceptance test is passed, the codes of the issued branches are merged into the main branch, so that a plurality of developers can be simultaneously supported to simultaneously develop the project by allowing the individual development branches to be created; by merging the codes of the individual development branches into the development branches, the codes of developers can be merged into the development branches in time, so that the timeliness of code merging is improved; the code branch can be timely detected through the local integration test and the system integration test, compared with the prior art, the local integration test can be performed before the system integration test, and the code detection efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart illustrating a code branch management method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating an example of a method for managing code branches according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a code branch management apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a code branch management apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a code branch management apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
Embodiments of the present invention relate to the following terms, which are explained below:
git: git is a distributed version control tool. Git can perform complete version control work locally at the user, and save, modify and rollback version information of file modification, and the like. Collaboration between different users may be performed through the Git server.
branch: the branch can separate part of the work from the development mainline so as not to influence the development mainline.
SIT (system integration test): SIT, shorthand for English System Integration Test, system Integration Test. On the basis of unit testing, all modules are assembled into a subsystem or a system according to design requirements, and integrated testing is performed.
UAT (user acceptance test): UAT, shorthand for User Acceptance Test, or User Acceptance Test, a stage of the system development lifecycle methodology, in which the relevant User or independent tester tests and receives the system according to the Test plan and results. It lets the system user decide whether to receive the system. It is a test that determines whether a product can meet a contract or a user-specified requirement.
Currently, three mainstream code branch management methods are used for trunk-based development (TBD), gitflow, and GitHub flow. As shown in table 1, there are three types of comparison tables for code branch management. However, the trunk development has the problem that code detection is difficult to perform in time, the gitflow has the problem that code branches are difficult to merge in the project development era, and the GitHub flow has the problem that the number of developers is limited. Under the condition that the requirement of a large enterprise on the code management intensity is gradually increased, a code management mode which can well solve the problems does not exist.
Table 1: branch management mode comparison
Figure BDA0002434238540000061
In an embodiment of the present invention, a code branch management method is provided to support multiple persons to perform project development simultaneously, and perform code detection and code branch merging in time, as shown in fig. 1, the method includes:
step 101: acquiring codes from the development branches, and creating individual development branches; the personal development branch is used for the development personnel to develop the project locally;
step 102: carrying out local integration test on the developed individual development branches;
step 103: if the local integration test is passed, merging the codes of the personal development branches into the development branches, and carrying out system integration test on the development branches;
step 104: if the system integration test is passed, acquiring codes from the development branch, creating a release branch, and performing user acceptance test on the release branch;
step 105: and if the user acceptance test is passed, merging the code of the issued branch into the main branch.
The embodiment of the invention provides a code branch management method and a device, wherein the method comprises the following steps: in project development, acquiring codes from a development branch, and creating a personal development branch; the personal development branch is used for the development personnel to develop the project locally; carrying out local integration test on the developed individual development branches; if the local integration test is passed, merging the codes of the personal development branches into the development branches, and carrying out system integration test on the development branches; if the system integration test is passed, acquiring codes from the development branch, creating a release branch, and performing user acceptance test on the release branch; if the user passes the acceptance test, merging the codes of the issued branches into the main branch, and performing production and use on the codes of the main branch. According to the embodiment of the invention, a plurality of developers can be simultaneously supported to simultaneously develop projects by allowing the individual development branches to be created; by merging the codes of the individual development branches into the development branches, the codes of developers can be merged into the development branches in time, so that the timeliness of code merging is improved; the code branch can be timely detected through the local integration test and the system integration test, and compared with the prior art, the local integration test can be performed before the system integration test, so that the code detection efficiency is improved.
In one embodiment, code is fetched from a development branch, creating a personal development branch; the individual development branch is used for the development of projects locally by developers.
The personal development branch is used for personal development and use of developers, supports reading and writing, is created based on the develop branch, contains all codes to be deployed to a personal test environment, and is used for the developers to carry out project development locally; the personal development branch can optionally create multiple pieces, and the personal development branch exists in the sense that each person can continuously integrate own code.
In specific implementation, the local integration test of the individual development branches after the development is completed may include: and carrying out local integration test on a plurality of individual development branches which are developed by developers.
The local integration test is carried out on the individual development branch, so that the codes can be detected better and more timely, if developers can carry out the local integration test on the codes preliminarily after the local codes are finished, and larger errors caused in the subsequent code detection process are avoided.
In specific implementation, if the local integration test is passed, codes of the personal development branches are merged into the development branches, and the system integration test is carried out on the development branches.
A development (develoop) branch is not directly submitted with codes, the development branch is always used as the most complete branch with the latest function, corresponds to the SIT environment and exists for a long time, and the read-write format is read-only; there is one and only one development branch. And when the system integration test is carried out, all modules are assembled into a subsystem or a system according to the design requirements on the basis of the unit test, and the integration test is carried out.
In specific implementation, if the system integration test is passed, the codes are obtained from the development branch, the release branch is created, and the user acceptance test is performed on the release branch.
And the release branch is created based on the latest version of the develop branch, corresponds to the UAT environment, and is used for performing production release on the project, and the read-write format is read-only. When the new function is enough to release a new version, a release branch is created from the develop branch to serve as the starting point of the new version, and the release branch corresponds to the UAT environment or the prefire environment. The user acceptance test (also called user acceptance test) is performed by the relevant user or independent tester to test and receive the system according to the test plan and the test result, so that the user of the system can decide whether to receive the system.
In specific implementation, if the user acceptance test is passed, the codes of the issued branches are merged into the main branch.
The main (master) branch stores all versions released by the production environment, and is used as a project history version recording branch without directly submitting codes. The master branch always corresponds to the production environment service version. The main branch does not perform any test, development and repair, and is only used for keeping a code base (code source) of a code running on a corresponding line. The main branch exists for a long time, the read-write format is read-only, and only one main branch exists.
In specific implementation, the method for managing a code branch provided by the embodiment of the present invention further includes: acquiring codes from the individual development branch, and creating a characteristic branch; the code of the property branch is merged into the individual development branch.
A feature branch is created based on a develop branch, is mainly used for developing a new function, supports multi-person cooperation to develop the new function, supports reading and writing, and can be named according to a function point, such as a dashboard (instrument panel); the characteristic branch can also be called as a function development branch, and the completed function is combined to a develop branch after the function development is completed. A plurality of feature branches can exist at the same time and are used for simultaneously developing a plurality of functions in a team; belongs to temporary branches and should be deleted after the function is completed.
In specific implementation, the code branch management method provided in the embodiment of the present invention may further include: if the user acceptance test is not passed, acquiring a code from the release branch, and creating a hot repair branch; and after the repair is finished, merging the codes of the hot repair branches into the development branches, carrying out system integration test on the development branches again, and if the re-test passes, re-creating the release branches.
A hot fix (hotfix) branch, which may also be called a patch branch or a BUG fix branch, is created based on a release branch, and is mainly used for BUG fix on a version on a line. And after the repair is finished, merging the repaired branch and the repaired branch, releasing a new release version again, and marking a new Tag. The hot fix (hotfix) branch belongs to a temporary branch, only 1 branch exists at the same time, the life cycle is short, and the patch is deleted after being repaired. Compared with the backbone development method in the code branch management method in the prior art, in the actual development work of the backbone development method, the problem of the code management of a single backbone is not great during the new establishment of a project, but if the project enters the maintenance period, the contradiction is easily caused between the instantaneity of emergency repair and the periodicity of version development. The code branch management method provided by the embodiment of the application can be used for creating the hot repair (hot fix) branch in time when a code error occurs and needs to be repaired urgently, repairing the code in time without waiting for a long time, and the flow is not complex, so that the contradiction between the instantaneity of urgent repair and the periodicity of version development does not exist.
In specific implementation, the code branch management method provided in the embodiment of the present invention may further include: after the code of the main branch is put into production and used, if a code error occurs, acquiring the code from the release branch merged into the main branch, and creating a hot repair branch; and after the repairing is finished, merging the codes of the hot repairing branches into the development branches, carrying out system integration testing on the development branches again, and if the re-testing is passed, re-creating the release branches.
After the user acceptance test, the finished project can be printed with a version number for production and release. BUG found in the production environment can not be directly repaired in the branch, but the branch is repaired in the hot branch and then merged with release for extraction and detection, and then a new release branch version is released.
In specific implementation, the code branch management method provided in the embodiment of the present invention may further include: when the codes of the personal development branches are merged into the development branches, updating the version numbers of the development branches; and when the code of the issued branch is merged into the main branch, updating the version number of the development branch.
For example, a usage of a tag corresponding to a version number is provided, the tag is a certain key version, a naming specification of each branch is defined as "v major version number, minor version number, revision number, advanced version number", and a version number increment rule is as follows:
1. major version number: incompatible API (Application Programming Interface) modification is carried out; 2. minor version number: a new functional addition of downward compatibility is made; 3. revision number: problem correction of downward compatibility is carried out; 4. advanced version number: an extension may be added to the "major version number. Minor version number. Revision number" as follows, such as: v1.5.3-alpha1; v2.3.14-beta3.
For example, v1.5.3-alpha1, v represents that the version is a major version number, 1 represents a large version; 5 represents a minor version number, usually with some new functionality added; 3 is a revision number, which usually indicates the repair of some problems; -for a delimiter, alpha indicates that the current version belongs to the inline stage, 1 is the inline environment or small inline version variation;
for example, v2.3.14-beta3, v represents that this is a version, 2 is the major version number, representing a large version; 3 represents a minor version number, usually with some new functionality added; 14 is a revision number, typically indicating the repair of some problem; -is a separator, beta indicates that the current version belongs to the metric stage, 3 is an internal environment or metric minor version change.
In specific implementation, the code branch management method provided in the embodiment of the present invention may further include: a Git submission code specification is set.
In the Git submission code specification, for the basic syntax, each time the local code change is submitted to the remote, the submission specification needs to be noted, otherwise, the submission to the remote is not allowed.
<Type>(<Scope>:<Risk>):<Story><Subject>
<BLANK LINE>
<Body>
<BLANK LINE>
<Footer>
The meaning of the code is as follows:
type (extent of influence: risk): associated user story summaries
Empty line
Modifying information
Empty line
Remarks for note
In the Git submission code specification, a description of a set of code syntax is also included, as shown in table 2, table 2 is the Git submission code specification in the code branch management method provided by the embodiment of the present invention. When the version is submitted to the code warehouse every time, the submission template is applied according to the submitted information, if the developer modifies the description file, namely the read.
Doc (location: A) #106 modifies the description file
The tail part is added with the description information of the newly added module
This time the modification of the member B provides the opinion
Table 2: the invention provides a Git submission code specification in a code branch management method
Figure BDA0002434238540000101
For the above code specification submitted by Git, the embodiment of the present application also provides an example, and the code is as follows:
Figure BDA0002434238540000102
Figure BDA0002434238540000111
the above codes have the following meanings:
feat(location:A):#453:sangjing add a date file
the new function is submitted at this time, the influence range is small, the risk is low, the number of the related user story is 453, and a date file is added in the operation.
Figure BDA0002434238540000112
This is a detailed description of the operation, and a date file 20190909.Txt is uploaded, and this file is very important and uses an account of an administrator.
Today is Fri.
The remark is friday today.
An embodiment of the present invention further provides an example of a code branch management method, as shown in fig. 2, fig. 2 is a flowchart illustrating an example of a code branch management method provided in an embodiment of the present invention.
Three development members ABC need to modify some codes respectively and cooperate to perform two functions, wherein one function is based on a module of a developer A, the other function is a brand-new characteristic, three sets of environments are deployed, and the current project version is v0.1.0. The developer A and the developer C respectively create respective individual development branches, respectively obtain codes from nodes of the development branches passing the latest test, namely corresponding to the v0.1.0 version on the line, and then carry out daily project development.
When a function is jointly developed by multiple persons, a developer A creates a temporary characteristic branch based on the current personal development branch of the developer A, invites the developer BC to develop the branch together, merges the characteristic branch into the personal development branch of the developer A after the characteristic development is finished, marks the version v0.1.1 of the personal development branch, and deletes the temporary characteristic branch.
After the local integration test is performed on the individual development branches, the individual development branches are merged into the development branches for the system integration test, but the test fails, so that the developer A modifies a version on the individual development branch and marks the version v0.1.2, then merges the modified individual development branches into the development branches, and performs the system integration test on the development branches, and the test passes.
The developer C always carries out daily development locally, and at the moment, the developer C wants to merge codes of own personal development branches into the development branches for testing, so that the developer C firstly executes pull operation to merge the latest codes of the remote development branches into the local development branches and then merges the latest codes, wherein the merging step is to acquire the codes from the development branches, merge the personal development branches and then merge the personal development branches into the development branches, and the developer C firstly acquires the latest codes from the development branches into the local development branches because the code merging is likely to generate code conflicts, and then merges the latest codes into a warehouse to avoid the conflicts if the conflicts exist. After the system integration test is passed, the version can be released at this time, so that a label v0.2.0 is marked on a development branch node which passes the test latest, a release branch release-v0.2.0 is created, a user acceptance test environment is entered after the release, but a significant BUG is found in the version, a temporary hot branch is created on the development branch of the version for BUG repair, the repair is combined on a Defelop main development branch and passes the test, a label v0.2.2 is marked on a node which passes the test latest at this time, a release branch release-v0.2.2 is created, and the user acceptance test environment is entered after the release, and the test is passed.
At this time, the obsolete original release branch release-v0.2.0 and the temporary hotfix branch should be deleted. At the moment, production is put on line based on the release-v0.2.2 version, codes are merged into a main branch after the codes are released to a production test without problems, but production accidents occur after the codes are operated for several days, and the production accidents are caused by code bugs.
And performing emergency repair, creating a hot branch based on the latest release branch, and directly merging the hot branch code into the release branch and the develop branch after the repair is completed. And after the Release test has no problem, a new label v0.2.7 is printed, the production environment is released, and the code is merged into the master.
The developer A continues new development work, codes of the individual development branches are merged into the Defelop branch, a new Release branch Release-v0.3.0 is created based on the Defelop branch after the system integration test passes, the new Release branch Release-v0.3.0 is marked as version v0.3.0, the user acceptance test is successfully passed, and at the moment, the Release branch Release-v0.3.0 is finally merged into the master branch.
As can be seen from the above embodiments, the embodiments of the present invention can support a plurality of developers to develop projects at the same time by allowing the creation of individual development branches; by merging the codes of the individual development branches into the development branches, the codes of developers can be merged into the development branches in time, and the timeliness of code merging is improved; the code branch can be timely detected through the local integration test and the system integration test, compared with the prior art, the local integration test can be performed before the system integration test, and the code detection efficiency is improved.
In an embodiment, resident branches and temporary branches may be determined by usage habits and enforcement norms for large-scale teams. Wherein the resident branch is a main branch and a development branch; the temporary branches are performance branches, hot fix branches, individual development branches, and merge branches. Because the number of developers is large and the test pipeline is required, the developers have respective individual development branches; as a module developed by multiple persons in a coordinated manner exists, a temporary characteristic branch exists; creating a Develop branch for integrated deployment based on the integration environment; based on the Release branch of the acceptance environment, the acceptance is passed by keeping the branch and not passed by deleting the branch; and a master branch that always corresponds to the production environment. The embodiment of the invention allows the existence of the user personal branch, and drives the branch management by the deployment environment, such as the local integration test corresponding to the personal branch, the SIT environment (system integration test) corresponding to the develop branch, and the UAT environment (user acceptance test) corresponding to the release branch. In the embodiment of the invention, the master branch is always consistent with the code running on the line, is always merged by the release branch, and is merged after the release is finished. According to the embodiment of the invention, the hotfix branch only repairs the release branch and the develop branch.
Based on the same inventive concept, the embodiment of the present invention further provides a code branch management apparatus, as described in the following embodiments. Because the principle of the code branch management device for solving the problem is similar to the code branch management method, the implementation of the code branch management device can refer to the implementation of the code branch management method, and repeated details are not repeated. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 3 is a block diagram of a structure of a code branch management apparatus according to an embodiment of the present invention, as shown in fig. 3, including:
the personal development branch creating module 01 is used for acquiring codes from the development branches and creating personal development branches; the personal development branch is used for the development personnel to develop the project locally;
the local integration test module 02 is used for carrying out local integration test on the individual development branches after the development is finished;
the system integration test module 03 is used for merging codes of the personal development branches into the development branches and performing system integration test on the development branches if the local integration test passes;
the user acceptance testing module 04 is used for acquiring codes from the development branch if the system integration test is passed, creating a release branch and performing user acceptance testing on the release branch;
and the main branch merging module 05 is used for merging the codes of the issued branches into the main branches if the user acceptance test is passed, and putting the codes of the main branches into production for use.
In one embodiment, the method further comprises: a characteristic branch creation module to:
acquiring codes from the individual development branch and creating a characteristic branch;
the code of the property branch is merged into the individual development branch.
In one embodiment, the method further comprises: a hot fix branch creation module to: when the user fails the acceptance test, acquiring codes from the issuing branch, and creating a hot repair branch;
the system integration test module is further configured to: after the repair is finished, merging the codes of the hot repair branches into the development branches, and carrying out system integration test on the development branches again;
the user acceptance test module is further configured to: and after the system integration test is passed again, the release branch is created again.
In an embodiment, the apparatus further includes a post-production modification module 06, as shown in fig. 4, fig. 4 is a schematic structural diagram of a code branch management apparatus according to an embodiment of the present invention. The post-commissioning modification module is to: after the code of the main branch is put into production and used, if a code error occurs, acquiring the code from the release branch merged into the main branch, and creating a hot repair branch;
the system integration test module is further configured to: after the repair is completed, merging the codes of the hot repair branches into the development branches, and performing system integration test on the development branches again;
the user acceptance test module is further configured to: and after the system integration test is passed again, the release branch is created again.
In one embodiment, the method further comprises: as shown in fig. 5, fig. 5 is a schematic structural diagram of a code branch management apparatus according to an embodiment of the present invention. The version number updating module is used for: when the codes of the personal development branches are merged into the development branches, updating the version numbers of the development branches; when the code of the release branch is merged into the main branch, the version number of the development branch is updated.
An embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the method when executing the computer program.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program for executing the method is stored in the computer-readable storage medium.
In summary, in the embodiments of the present invention, a code is obtained from a development branch, and a personal development branch is created; the personal development branch is used for the development of the project locally by a developer; carrying out local integration test on the developed individual development branches; if the local integration test is passed, merging the codes of the personal development branches into the development branches, and carrying out system integration test on the development branches; if the system integration test is passed, acquiring codes from the development branch, creating a release branch, and performing a user acceptance test on the release branch; if the user passes the acceptance test, merging the codes of the issued branches into the main branch, and putting the codes of the main branch into production for use, so that a plurality of developers can be simultaneously supported to simultaneously develop projects by allowing the creation of individual development branches; by merging the codes of the individual development branches into the development branches, the codes of developers can be merged into the development branches in time, so that the timeliness of code merging is improved; the code branch can be timely detected through the local integration test and the system integration test, compared with the prior art, the local integration test can be performed before the system integration test, and the code detection efficiency is improved.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes may be made to the embodiment of the present invention by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A method of code branch management, comprising:
acquiring codes from the development branches, and creating individual development branches; the personal development branch is used for the development of the project locally by a developer;
carrying out local integration test on the developed individual development branches;
if the local integration test is passed, merging the codes of the personal development branches into the development branches, and carrying out system integration test on the development branches;
if the system integration test is passed, acquiring codes from the development branch, creating a release branch, and performing a user acceptance test on the release branch;
if the user acceptance test is passed, merging the code of the issued branch into the main branch;
further comprising: if the user acceptance test fails, acquiring a code from the issuing branch, and creating a hot repair branch; after the repairing is finished, merging the codes of the hot repairing branches into the development branches, carrying out system integration testing on the development branches again, and if the re-testing is passed, re-creating the release branches;
further comprising: after the code of the main branch is put into production and used, if a code error occurs, acquiring the code from the release branch merged into the main branch, and creating a hot repair branch; and after the repair is finished, merging the codes of the hot repair branches into the development branches, carrying out system integration test on the development branches again, and if the re-test passes, re-creating the release branches.
2. The method of claim 1, further comprising:
acquiring codes from the individual development branch and creating a characteristic branch;
the code of the property branch is merged into the individual development branch.
3. The method of claim 1, further comprising:
when the codes of the personal development branches are merged into the development branches, updating the version numbers of the development branches;
and when the code of the issued branch is merged into the main branch, updating the version number of the development branch.
4. A code branch management apparatus, comprising:
the personal development branch creating module is used for acquiring codes from the development branches and creating personal development branches; the personal development branch is used for the development personnel to develop the project locally;
the local integrated test module is used for carrying out local integrated test on the individual development branches after the development is finished;
the system integration testing module is used for merging codes of the individual development branches into the development branches after the local integration testing is passed, and performing system integration testing on the development branches;
the user acceptance testing module is used for acquiring codes from the development branch after the system integration testing is passed, creating a release branch and carrying out user acceptance testing on the release branch;
the main branch merging module is used for merging the codes of the issued branches into the main branches after the user acceptance test is passed, and putting the codes of the main branches into production for use;
further comprising: a hot fix branch creation module to: when the user fails in the acceptance test, acquiring codes from the issuing branch and creating a hot repair branch;
the system integration test module is further configured to: after the repair is finished, merging the codes of the hot repair branches into the development branches, and carrying out system integration test on the development branches again;
the user acceptance testing module is further configured to: after the system integration test is passed again, the release branch is created again;
a post-commissioning modification module to: after the code of the main branch is put into production and used, if a code error occurs, acquiring the code from the release branch merged into the main branch, and creating a hot repair branch;
the system integration test module is further configured to: after the repair is finished, merging the codes of the hot repair branches into the development branches, and carrying out system integration test on the development branches again;
the user acceptance test module is further configured to: and after the system re-integration test passes, re-creating the release branch.
5. The apparatus of claim 4, further comprising: a characteristic branch creation module to:
acquiring codes from the individual development branch and creating a characteristic branch;
the code of the property branch is merged into the individual development branch.
6. The apparatus of claim 4, further comprising: a version number update module to:
when the codes of the personal development branches are merged into the development branches, updating the version numbers of the development branches;
and when the code of the issued branch is merged into the main branch, updating the version number of the development branch.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 3 when executing the computer program.
8. A computer-readable storage medium, characterized in that it stores a computer program for executing the method of any one of claims 1 to 3.
CN202010247066.6A 2020-03-31 2020-03-31 Code branch management method and device Active CN111352651B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010247066.6A CN111352651B (en) 2020-03-31 2020-03-31 Code branch management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010247066.6A CN111352651B (en) 2020-03-31 2020-03-31 Code branch management method and device

Publications (2)

Publication Number Publication Date
CN111352651A CN111352651A (en) 2020-06-30
CN111352651B true CN111352651B (en) 2023-03-31

Family

ID=71194706

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010247066.6A Active CN111352651B (en) 2020-03-31 2020-03-31 Code branch management method and device

Country Status (1)

Country Link
CN (1) CN111352651B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111783104B (en) * 2020-07-02 2021-04-06 北京自如信息科技有限公司 Vulnerability checking method, vulnerability checking method and device for continuous integrated codes
CN111966360A (en) * 2020-08-18 2020-11-20 浪潮云信息技术股份公司 Unit application development method and system for project release management model
CN112579126A (en) * 2020-12-21 2021-03-30 杭州米络星科技(集团)有限公司 Software development platform and software development method
CN112667282A (en) * 2020-12-30 2021-04-16 北京大米科技有限公司 Version management method, related device and computer medium
CN112631554B (en) * 2020-12-30 2024-07-23 中国农业银行股份有限公司 Project demand management method, device and equipment
CN112579475A (en) * 2020-12-31 2021-03-30 平安银行股份有限公司 Code testing method, device, equipment and readable storage medium
CN113190447A (en) * 2021-04-30 2021-07-30 成都新潮传媒集团有限公司 Method, device, equipment and storage medium for automatically merging codes
CN113485916A (en) * 2021-06-21 2021-10-08 上海百胜软件股份有限公司 Detection method, system, device and storage medium based on JIRA code construction
CN113448614B (en) * 2021-06-29 2024-06-14 北京金山云网络技术有限公司 Software project code management method, device, storage medium and electronic equipment
CN113741948A (en) * 2021-08-31 2021-12-03 上海浦东发展银行股份有限公司 Code branch management method, device, equipment and storage medium
CN113760234B (en) * 2021-09-06 2023-06-27 小叶子(北京)科技有限公司 Software development method and system
CN113791977A (en) * 2021-09-09 2021-12-14 上海仙塔智能科技有限公司 Code development processing method and device, electronic equipment and storage medium
CN114741115B (en) * 2022-06-09 2022-09-30 好享家舒适智能家居股份有限公司 Data management method and system under multi-version concurrent scene
CN115291929B (en) * 2022-07-05 2023-04-11 华南师范大学 Programming block management system for artificial intelligence education graphical programming software
CN117850789A (en) * 2022-09-30 2024-04-09 中兴通讯股份有限公司 Version release method, electronic device, and computer-readable storage medium
CN115586919A (en) * 2022-10-13 2023-01-10 上海雷昶科技有限公司 Code management method and device based on git

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101932999A (en) * 2007-12-20 2010-12-29 汇丰技术股份有限公司 Automated methods and systems for developing and deploying projects in parallel
CN109522025A (en) * 2018-10-30 2019-03-26 深圳市小赢信息技术有限责任公司 A kind of code delivery system based on git
CN109960643A (en) * 2017-12-22 2019-07-02 网宿科技股份有限公司 A kind of code test method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10061688B2 (en) * 2013-05-14 2018-08-28 Noblis, Inc. Method and system to automatically enforce a hybrid branching strategy

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101932999A (en) * 2007-12-20 2010-12-29 汇丰技术股份有限公司 Automated methods and systems for developing and deploying projects in parallel
CN109960643A (en) * 2017-12-22 2019-07-02 网宿科技股份有限公司 A kind of code test method and device
CN109522025A (en) * 2018-10-30 2019-03-26 深圳市小赢信息技术有限责任公司 A kind of code delivery system based on git

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"Devops:项目多环节配置和健康检查";DevOps时代;《https://cloud.tencent.com/developer/article/1429807》;20190521;第2-4页 *
"Git Flow工作流总结";_Mitch;《https://www.jianshu.com/p/34b95c5eedb6》;20180917;第1-4页 *
DevOps时代."Devops:项目多环节配置和健康检查".《https://cloud.tencent.com/developer/article/1429807》.2019,第2-4页. *

Also Published As

Publication number Publication date
CN111352651A (en) 2020-06-30

Similar Documents

Publication Publication Date Title
CN111352651B (en) Code branch management method and device
CN109522025B (en) Code issuing system based on git
CN105144088B (en) Metadata is associated with and with source code based on its application and service
US8140907B2 (en) Accelerated virtual environments deployment troubleshooting based on two level file system signature
US9207933B2 (en) Identifying authors of changes between multiple versions of a file
CN109086071A (en) A kind of method and server of management software version information
JP5970617B2 (en) Development support system
US8312430B2 (en) Guarding code check-in with test case execution results
US8548947B2 (en) Systems and methods for file maintenance
US20220318130A1 (en) Auto test generator
US10621212B2 (en) Language tag management on international data storage
Walrad et al. The importance of branching models in SCM
US20090313606A1 (en) System and Method for Testing a Software Product
CN106708740B (en) Script testing method and device
KR20130135271A (en) Code clone notification and architectural change visualization
CN107315689A (en) The Automation regression testing method of granularity is retrieved based on Git code files
CN104090776A (en) Software development method and system
CN110865806A (en) Code processing method, device, server and storage medium
CN109271199A (en) A kind of method and system for database continuous integrating and script file management
US20080172659A1 (en) Harmonizing a test file and test configuration in a revision control system
Couder Fighting regressions with git bisect
Cugola et al. An experience in setting-up a configuration management environment
Michaud Detection of Named Branch Origin for Git Commits
CN117422285A (en) Operation flow inheritance method
Nystrom et al. Sciit: embedding issue tracking in source control management

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20220927

Address after: 25 Financial Street, Xicheng District, Beijing 100033

Applicant after: CHINA CONSTRUCTION BANK Corp.

Address before: 25 Financial Street, Xicheng District, Beijing 100033

Applicant before: CHINA CONSTRUCTION BANK Corp.

Applicant before: Jianxin Financial Science and Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant