This content originally appeared on DEV Community and was authored by Abir Moulick
Introduction
A well-structured branch management flow is crucial for handling frequent releases and immediate hotfixes efficiently. This article outlines a comprehensive branch management flow designed for regular periodic releases alongside urgent hotfixes, ensuring that features and fixes are tested thoroughly before reaching the production environment. By adopting this flow, teams can enhance collaboration, reduce integration issues, and accelerate time to market.
Branch Types
Main Branches
-
master
branch: This is your production branch, and it should always be stable, containing the code that is currently live in Main. -
develop
branch: This is your main development branch where all the features, enhancements, and non-critical bug fixes are merged first. This branch is live in Testing Server and Integrated testing is performed in every merge request.
Supporting Branches
-
Feature branches: New features or enhancements.
- Naming convention:
feature/<feature-name>
- Naming convention:
-
Bugfix branches: Non-critical bug fixes.
- Naming convention:
bugfix/<bug-name>
- Naming convention:
-
Release branches: Preparation for new releases.
- Naming convention:
release/vX.X.X
- Naming convention:
-
Hotfix branches: Critical fixes for production.
- Naming convention:
hotfix/<issue>
- Naming convention:
Workflow
Regular Release Cycle (Every 14 Days)
-
Feature Development
- Developers create
feature
branches fromdevelop
for each new feature. - After completion and local testing, developers will create a pull request to merge it back into
develop
. The branch is reviewed and then merged intodevelop
.
- Developers create
-
Bug Fixes
- Developers create
bugfix
branches fromdevelop
for each bugs. - After completion and local testing, developers will create a pull request to merge it back into
develop
. The branch is reviewed and then merged intodevelop
.
- Developers create
-
Release Workflow
- Every 14 days, create a
release
branch fromdevelop
. - Perform Integrated testing and any final tweaks on this branch.
- Once it's confirmed stable, merge
release
intomaster
and deploy to production. - Also, merge back into
develop
to ensure all changes are included in the next cycle.
- Every 14 days, create a
Hotfixes (Immediate Release)
-
Hotfix Workflow:
- When a critical issue is identified in production, developers create a
hotfix
branch directly frommaster
. - Fix the issue in the
hotfix
branch & test thoroughly. - Merge the
hotfix
branch first intomaster
and deploy immediately. - Also merge
hotfix
intodevelop
to ensure the fix is included in the ongoing development.
- When a critical issue is identified in production, developers create a
Conclusion
Adopting a structured branch management flow, offers numerous advantages to any software development team. Implementing such a branch management strategy empowers teams to tackle frequent releases and the need for rapid responses to critical production issues. However, this strategy depends on specific needs and dynamics of the team and varies from company to company.
This is my second blog writing. Feel free to comment if you have any questions or any refinement to the article. If you like the blog, don’t forget to like it & share with your friends/colleagues.
To get in personal touch, connect me on:
Linkedin:https://www.linkedin.com/in/abirmoulick/
Github:https://github.com/Abir10101/
Thanks for reading
Written with ❤️ & passion 🔥 by Abir Moulick
This content originally appeared on DEV Community and was authored by Abir Moulick
Abir Moulick | Sciencx (2024-06-26T13:38:42+00:00) Git Branch Management. Retrieved from https://www.scien.cx/2024/06/26/git-branch-management/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.