Git iterative development branch process specification

Preface

GitThe name is so loud, I believe everyone has heard of it. The famous same-sex dating website GitHubis Gitbased on the platform that is hosted as the only version library format. This article does not introduce Gitthe use of in detail, but only introduces Gitthe development branch process specifications based on , which requires Gita certain understanding.

Brief description

GitIn management, the most important point is branch management. In project development, Gitthe relevant branches generally involved are:

  1. 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.
  2. dev/develop: development branch, the development environment is built based on this branch.
  3. feature-*: Branch to develop a specific feature.
  4. hotfix- /fix- : bugFix branch.
  5. release-*: used for testing platforms.

For smaller projects, when there are fewer participants, you can only keep masterthe developbranch.

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.

developCode is written based on the branch every day . After the function is written, it is submitted directly to developthe branch to build the test environment and submitted for testing. If there is any problem, it is directly modified and submitted to the developbranch. That is, developthe code on the branch is the code used in the test environment.

At the end of the iteration, developmerge the branch into masterand make the official version tag.

git branch flow

Development Process

  1. developPull a new branch from the branch ( feature-*/fix-*).
  2. After development is completed, submit the branch to the remote warehouse.
  3. Create a merge request ( merge request, feature-*-> develop) and request the project manager to conduct a code review and merge the branch to develop.
  4. After the test passes, developmerge the branch to masterthe branch and mark it with the corresponding tag, 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 bugrepairs that needed to be repaired, which was quite urgent. However, the current developbranch has changed a lot of 1.1version functions, and testing has not been completed, so modifications cannot be made directly based on the current developbranch.

Fortunately, 1.0when the version was released before, developthe code of the branch was merged into masterthe branch. Now you only need to masterpull the code from the branch to modify it, and then merge the modified content into the branch masterfor release. It should be noted here that when developing developthe branch later, you must first pull masterthe code of and merge it. If there is any conflict, modify it to ensure that there will be no conflicts when developmerging from the branch to branch next time.master

Summarize

  • GitThe 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, Gitthe 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 bugwhen an online emergency needs to be repaired during an iterative process, that is, to ensure that the online environment always uses branch code:gitmaster

  1. masterCheck out the new branch from and make changes.
  2. Merge the modified code into masterthe branch, compile and publish, and hit tag.
  3. Merge the modified masterbranch into the currently developed developbranch to resolve conflicts.
  4. normal development process.

reference

Git version management specification (Git Flow)
Detailed steps for using Git for branch management during rapid product iteration

Guess you like

Origin blog.csdn.net/DisMisPres/article/details/126304890