Analysis of Ali A oneFlow mode of project version and branch management

foreword

In my previous project management experience, a project needs to maintain multiple products and multiple versions, which makes the management of versions and branches more difficult. There was no attention in the early stage, which made too many branches too messy, and the version was not recorded well, which caused a lot of problems. In the management mode of various branches and versions, Alibaba's AoneBased mode is finally used to manage branches. I will make a summary here and share it with you, hoping to help you find a version management method suitable for your project.

background

When encountering a more complex self-research project, it is necessary to do not only the research and development of original functions, but also the customized development of products. The previous version management is roughly as follows:

  • 1. A total of one trunk branch master
  • 2. N feature branches == N release branches (after the development of the feature branch is completed, it is directly transferred to the test and directly converted to the release branch)

  • 3. The main problems caused by the irregular update of the main branch are:
  • 1. The main branch often cannot keep up with the code of the online environment
  • 2, a large number of merge conflicts, integration testing is not friendly
  • 3. The version records are confusing and the function points are not clear
  • 4. When a function is suddenly withdrawn, it is necessary to manually cancel the corresponding code
    . In short, there are many problems, and the management of the entire project code is chaotic, which is very unfavorable for maintenance. After sorting out the thoughts, first summarize some common version management modes.

    1. TrunkBased mode

    composition

    One trunk branch + multiple release branches

    manual

    Each release branch is pulled from the main branch at a specific commit point for live deployment and hotfix.

    shortcoming

    When multiple teams or multiple products are being developed in parallel on the same trunk branch, it's a disaster at release time. Frequent integrations and adequate test coverage are required.

    summary

    TrunkBased such a mock test should be relatively common. However, most of them are developed on the main branch. Although it is possible to keep the latest code, it is very unfavorable for later maintenance. The usage scenarios are too limited, and it is suitable for projects with relatively single version maintenance and long iteration cycles. For example, the company's official website has uncomplicated functions, and most of them maintain pictures or dynamics. This version management mode can be considered.

    2. OneFlow mode

    This mode is an upgraded version of TrunkBased, which adds Hotfix branches and adopts a multi-trunk mode, generally dual trunks (one trunk branch + one trunk release branch). OneFlow has made an improvement in the evolution of the TrunkBased mode, separating the trunk branch and the release branch, which effectively avoids some problems. However, it also cannot meet the parallel development of multi-version and multi-product.

    3. GitFlow mode

    composition

    One trunk branch + one development branch + N feature branches + N release branches + N Hotfix branches

    manual

As can be seen from the flow chart, the trunk branch keeps the code in sync with the live environment, but there is a master release branch that isolates untested unstable code. Every time the project has new requirements, pull a newest feature branch from the main branch for development. When the development is completed, it is merged into the release branch for integration and testing, and then merged into the main branch after the release is successful.

summary

It can be seen that the GitFlow version management mode is more in line with the parallel development of multiple versions. So it is very popular with some companies that are very process-oriented. However, there are still problems in the implementation of the seemingly good model. Such as a lot of merge conflicts, unfriendly integration tests, etc. In this case, Ali's AoneFlow mode can improve these problems very well, let's see.

4. AoneFlow mode

composition

One trunk branch + N feature branches + N release branches

manual


As can be seen from the flow chart, the AoneFlow mode has only one trunk branch. Pull a feature branch from the current trunk branch every time there is a new requirement. Multiple feature branches can be developed synchronously, and when the release time node is reached, different branches can be merged according to different environments. Such as test environment release branch, performance environment release branch, online environment release branch, etc. After a successful release, the code from the release branch should be merged onto the main branch. Similarly, tag each time you merge into the main branch and keep a record. Finally, delete the associated feature branch on the release branch.

summary

It can be seen that the AoneFlow mode is very suitable for maintaining different environments and different versions, and no redundant branches will be generated. The main branch is consistent with the online environment. When we encounter a feature that needs to be undone, we can directly roll back to a merge record, remove a release branch, and merge the other branches. Good for maintainability. The entire process is simple and regular, and project versions and branches are easily and efficiently managed.

Summarize

Through the above series of analysis and sorting, the version management problems I encountered in the project have been solved. I believe that everyone can find a suitable management method for the project. In any case, the records of large and small versions are indispensable. In order to manage a project well and make the project more readable and maintainable, we need to do a lot of detailed work. Every link is looking for a better way. Version management is only a part of it, there is a long way to go, and there is a long way to go. Welcome everyone to give pointers!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324403172&siteId=291194637