Preface
Git
The name is so loud, I believe everyone has heard of it. The famous same-sex dating website GitHub
is Git
based on the platform that is hosted as the only version library format. This article does not introduce Git
the use of in detail, but only introduces Git
the development branch process specifications based on , which requires Git
a certain understanding.
Brief description
Git
In management, the most important point is branch management. In project development, Git
the relevant branches generally involved are:
- master/main: The master branch. The code for the official release of the version is compiled with the code of this branch. It is often set as a protected branch.
- dev/develop: development branch, the development environment is built based on this branch.
- feature-*: Branch to develop a specific feature.
- hotfix- /fix- :
bug
Fix branch. - release-*: used for testing platforms.
For smaller projects, when there are fewer participants, you can only keep master
the develop
branch.
This is just a branch management of a regular project, for reference only, and the specific situation needs to be analyzed in detail.
The actual situation
I am currently developing a project. The code is written by myself and is undergoing short-term iterations.
develop
Code is written based on the branch every day . After the function is written, it is submitted directly to develop
the branch to build the test environment and submitted for testing. If there is any problem, it is directly modified and submitted to the develop
branch. That is, develop
the code on the branch is the code used in the test environment.
At the end of the iteration, develop
merge the branch into master
and make the official version tag
.
Development Process
develop
Pull a new branch from the branch (feature-*/fix-*
).- After development is completed, submit the branch to the remote warehouse.
- Create a merge request (
merge request
,feature-*
->develop
) and request the project manager to conduct a code review and merge the branch todevelop
. - After the test passes,
develop
merge the branch tomaster
the branch and mark it with the correspondingtag
, usually official version number.
The above process will be repeated for each version of the project.
problem solved
During the iteration process ( 1.1
), it was discovered that the last official version ( 1.0
) was released, and there were major bug
repairs that needed to be repaired, which was quite urgent. However, the current develop
branch has changed a lot of 1.1
version functions, and testing has not been completed, so modifications cannot be made directly based on the current develop
branch.
Fortunately, 1.0
when the version was released before, develop
the code of the branch was merged into master
the branch. Now you only need to master
pull the code from the branch to modify it, and then merge the modified content into the branch master
for release. It should be noted here that when developing develop
the branch later, you must first pull master
the code of and merge it. If there is any conflict, modify it to ensure that there will be no conflicts when develop
merging from the branch to branch next time.master
Summarize
Git
The process design is still great. Once you are familiar with it, you can easily carry out joint development work. It is recommended to spend more time to understand it.- For projects of different scales and scenarios,
Git
the workflow can be changed and optimized on its own. The ultimate goal is to build a project system conveniently, quickly and accurately.
This article mainly describes the design of the workflow bug
when an online emergency needs to be repaired during an iterative process, that is, to ensure that the online environment always uses branch code:git
master
master
Check out the new branch from and make changes.- Merge the modified code into
master
the branch, compile and publish, and hittag
. - Merge the modified
master
branch into the currently developeddevelop
branch to resolve conflicts. - normal development process.
reference
Git version management specification (Git Flow)
Detailed steps for using Git for branch management during rapid product iteration