We have a big enterprise project and we have some stages of development. We use git. The branching looks like this:
DEV -> SIT -> PROD
DEV branch is development branch as is. When dev is done it's pushed to SIT branch, and the SIT source is used by QA for testing stage. For release the PROD is used.
So the question: if DEV is finished and SIT testing have been started and a bug was found, what is the correct flow?
1:
2:
Create a branch from DEV and push bugfix to DEV.
Push changes from DEV to SIT
What flow is correct 1 or 2?
I want to know the best practice
Both are valid strategies you can use.
Option 1
pros:
cons:
Option 2
pros:
cons:
Personally I like the second option as it is more streamlined and easy to maintain in DEV. You can also check out these workflows to get some other ideas.
This question doesn't have a 'TRUE' answer but as a developer, you shouldn't reinvent the wheel. There are already broadly accepted branching strategies independent of project:
I would recommend to read them through and decide with your team. And only apply these flow. There are also tools to force each strategy.
Create a hotfix branch from SIT fix the issue there. If the test passes, merge it to SIT and then rebase DEV from SIT
SIT -> create branch fix/issue
QA PASS -> merge fix/issue into SIT -> rebase dev from SIT
Git flows highly depends on your development environment and stack. Github, Bitbucket and GitLab have their own recommendations and best practices.
I recommend to read all of them: Github flow , Bitbucket recommendations , GitLab flows .
As for me both of your bugfix options not optimal and makes flow more complex. Creating additional useless branch for butfix, than make new merge to SIT or DEV. There's no points in all of these operations. What if you find new bug in your DEV-feature? New branches|merges?
I recommend to use Stable mainline branching flow.
feature -> pull --rebase PROD & push -f -> remote/feature -> QA testing -> PROD
| |
FIX <--- <--- <--- bug
Step by step:
feature
branch from prod
. feature
functional/fixes. feature
complete rebase it on latest prod
and force push. remote/feature
branch. remote/feature
repeat steps 2-4. remote/feature
to prod
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.