Sagar Pandey
Posted on September 17, 2024
Overview
git branch management is something i am sure we all struggle.
Application which are platform dependent might face this problem quite frequently as the platform licensing restrict them to have unlimited dev environment which is not the case for open source dependent application. Thus git flow or trunk based approach doesn’t suit well here. I want to publish this approach to have a discussion/debate around it and if possible get a better suited approach which others are using. Burn the comments section for the same.
You are free to make a pass if you don’t fall under this scenario.
When there are multiple teams working on same git repository and the release plan is highly agile. ie. when story/feature will be deployed is not certain , in that case a master/main branch based approach results in minimum conflicts. I have named this master/main affinity based branches as “mainly”.
The core of this approach is to have a feature branch from main branch and merge it wherever needed till the lifecycle of the feature.
1. Regular Development Cycles
1.1 Working on features using master/main based branches
- Create a branch from master , name it feature/_FeatureName Ex: feature/58484_Login
- Raise a PR to Environment Branch Ex: UAT Branch or a release branch
- Run the pipelines from the Environment/Release branch.
1.2 Conflicts resolution
-
Create a intermediate branch from Environment branch
Ex: UAT_featurename_Merge from release/UAT_BRANCH
-
Merge your feature branch to Environment branch
i.e. merge feature/login —> UAT_featurename_Merge
-
Raise PR from intermediate branch to environment branch
i.e. UAT_featurename_Merge —> release/UAT_BRANCH
-
Successive changes can be directly PRed from feature to enviroment branch.
i.e. feature/login —> release/UAT_BRANCH
2. Moving to upstream environments (PROD)
Assume we have feature branches feature/login , feature/myProfile and feature/myContacts
Only login and myProfile are planned to be release to upstream environment.
- Create a release branch Ex: release/master_v1
- Raise PR and merge feature/login and feature/myProfile
- Raise a PR from release/master_v1 to main
- Run the pipelines either from main or if you want to stage your changes then stage it from release/master_v1
Posted on September 17, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024