'git flow for feature branch
The current git flow for the team.
3 branches in total
main
develop
feature
When we're in the development stage
When there is a new jira ticket, we will create a feature branch from develop.
After completing the feature, we will merge the feature into develop.
When we want to update the main branch, we will merge develop into main branch.
But the application is now open to public, we want to have better git flow.
As usual, if we finish the feature, we will merge it into develop branch.
Then the tester will test if the feature is completed without bug.
Once the testers've tested, they will ask us(developers) to deploy ONLY that feature,
which is totally different from previous practice
For example, if developers complete feature A and then the testers've verified it in develop branch, after that we have to merge only feature A into main branch.
Therefore I want to know if there is any suggested flow for this situation.
Solution 1:[1]
Git Flow works best when you periodically release a set of features whose state exists in a single commit. This is why Git Flow recommends creating a release
branch from (a commit on) develop
which you wish to test. This may be one feature or many, but the intention is that all of the features at that commit will be released. Bug fixes to any of those features are done on the release
branch so that new development can simultaneously continue on develop
.
Another way to think about Git Flow is this:
Once you merge your code into
develop
, it is intended to be deployed with the next release (or the one after that if there is currently one in progress).
Even though the desired tweak you wish to make to your workflow is conceptually trivial, I believe it's enough that you should no longer use Git Flow. You might be able to stick with Git Flow if you made a new release
branch for every feature, but then you would need to release them in the order they were created, or else you'll end up needing to do a lot of reverting to cut out specific features you wish to skip.
Based on the description of your situation, my proposed solution is to use what the maintainers of Git use, which is called Gitworkflows. The changes would include:
- Rename your
develop
branch tonext
. - Periodically reset
next
tomain
. (Once per week, or iteration often works well.) - Have developers branch off of
main
for new features. - Merge those feature branches into
next
for integration testing. - Once approved, merge those feature branches into
main
and deploy to production.
That being said, at my company in one of our larger repos, we actually do a combination of both. We use Git Flow pretty much the "standard" way (and feature branches still come off of develop
), but we validate the features by merging them into a branch called next
, sometimes fixing them up and merging in again multiple times, before finally merging them into develop
. By the time we create a release
branch from develop
it's already pretty well hardened, and bug fixes on the release
branch are oftentimes minimal. This hybrid workflow may work well for you if you wish to sometimes release multiple features together. But if your normal use case is to release one feature at a time, then I'd probably consider skipping the overhead of Git Flow.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | TTT |