In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what is the Git branch management strategy". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
Branch Doubts Caused by Using Git
Why git is good, why git is used, is not the question I want to explain in this article.
Here I would like to share with you the doubts that arise in the process of using it, and the process of solving these doubts. Then again, I am still full of doubts. I don't know if I'll be confused when I'm 30.
In using git, its branching function makes me really ecstatic, but it is a double-edged sword, and if you are not careful, you will get this git roadmap:
Photo Source: Teacher Ruan Yifeng's Blog
My doubts:
So what kind of branching strategy should we use for development collaboration in teams?
In multiplayer teams, should we develop directly on the master branch?
If there is a bug on the line, what kind of branch should be used to fix it?
When there are multiple branches, how can testing effectively participate in testing each branch?
Solve problems with mature workflows
Before answering the questions above, introduce several workflows, and then answer them through workflow patterns. Because we have to be in a certain situation to discuss the idea of solving the problem.
The following three workflow methods are all function-driven development, that is, requirements are generated first, then corresponding branches are born, then development is carried out, and finally merged back to complete the mission is deleted.
Git flow
Github flow
Gitlab flow
For a detailed introduction to these three workflows, it is recommended to see this article-Ruan Yifeng
I now use Git flow, after my own practice, really easy to use, solve a lot of problems. Then if you find some discrepancies with your actual situation, you can make some changes and adjustments according to your needs.
my choice
I chose Git flow, whose main feature is that it has two branches for a long time:
Main branch master
development branch develop
Then, there are three auxiliary branches, all short-term, and half the time should only exist locally, not commit to a remote repository.
Functional branch (feature branch)
hotfix branch
Release branch
Suggested naming conventions for the above branches: feature-xxx, release-xxx, hotfix-xxx
Extra words: I used to like to underline, but later I found that you don't need to press shift to hit the center line. Haha, from then on, the center line era began.
When do you want functional branching?
When you get a requirement, or a bug fix that isn't an immediate requirement, you should branch out from develop and do that. After completion, merge into the develop branch.
When do I need to pre-branch?
This branch is prepared for prelaunch, and testing intervention should only occur when the branch is generated. When we whether it is new feature development, or general bug modification are almost the same. A release branch should be generated from develop and handed over to the test, and if there is a bug, it should be modified directly. When all is done, merge back into develop and merge into master.
I have to say a little more about this branch. Because this is a very important step, if we use the git hook, it will automatically be published online when merged into master, so this is the last barrier to going online.
Also, this solves one of my doubts, how does testing participate in each branch of git? The answer is that tests should not be involved in every branch, only in release branches. Other development branches should be tested by developers themselves. Only when there are no problems in the test can they be merged into develop. This requires each development to improve the quality of its delivered products. How to ensure the quality of its delivered products? Automated testing is a good option, OK, stop, this is not our main task today, this topic will be talked about another day.
When do patch branches need to be patched?
The less this happens, the better. Because the reason it happens is: there's a bug on the line, and it has to be fixed right away, no matter where you are, when your phone rings, take out your computer and fix it.
It is similar to release in that both need to be completed and merged into:master and develop. The difference is that it needs to branch off from master.
Note that there is no testing involved, half of it is a small emergency bug in the code, although it is serious, but it can be easily changed. Of course, if there are some exceptions, you should let the tests run before merging and publishing.
"Git branch management strategy is what" content introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.