How should one use branches to be able to test:
- on local environment (during development),
- on a branch for testing with real environment (QA-testing),
- testing by customers on pre-production branch,
- and finally merging to production?
We have the following branches: prod (customer production branch), dev(pre-production branch), staging(for QA), and local developers' branches.
For our current workflow, we have:
- For development and local testing, done in developers' branches.
- After code review, merge those local developers' branches to QA's branch.
- After QA tested, merge changes to pre-production customer branch (customer will test)
- Customer merges to production branch.
Problems appear on the second step. For example, we have some major tasks and some tasks that can wait. And developers already have done some major tasks and those tasks are already on step 2, but suddenly customers decide that some of the "can wait" tasks need to be done now and those changes should be merged right in pre-production branch so QA and customers could test it right away. Now customer liked all changes and he merges changes to production.
After all this we have:
- prod and pre-production are the same.
- staging branch is behind
- developers always start new tasks from the production branch
- a developer tested his task and wants to merge to staging (QA's branch)
- also some other developers finish some "can wait" tasks and QA is already testing them, so they are in staging branch
- But because branches are different he might have conflicts with other developers' work. But his work is a major task.
- Now he needs to fix conflicts. That means to update some changes from staging in his branch and merge to staging for testing.
- It results in a branch which started from production and has some chunks of code from staging (that have probably not been tested yet).
What we should do in such cases? What should a normal workflow look like?