I am currently in the middle of planning a new Git flow in my company and the new idea for it is to migrate over to forking and pull requests as well as add a staging branch for testing.
The proposed branch spec
master
(development) - contains bleeding-edge code from developers feature/bug branchesstaging
- pre-production codebase that would be autodeployed to a staging server. Tested by end-customer.production
- fully tested production-ready code that is autodeployed to the production server.
So eventually it would be something like: master
-> staging
-> production
Proposed setup flow
- there is the official
upstream
repo from which every developer forks their ownorigin
repo - they clone that to their local development
Proposed dev flow
- create a feature/bug branch from
master
- coffee2code magic
- When finished, they create a pull request to
upstream/master
from their branch
At this state other co-worker(s) would have a look at that PR and offer either suggestions or finally merge it in to upstream/master
from where the feature should eventually end up in staging for QA and then ff merged into production if tests pass.
Now the challenging part comes to moving the tested stuff to staging
for testing by the end-customer to accept the changes.
The possible approaches I've thought about:
Merging changes from
master
tostaging
- Whereas this seems the most simple way, it for some reason feels the most dangerous as well as unfinished code can end up in staging which in term might fail tests by end-customer.Cherry-picking from
master
tostaging
- A bit more safer than the above approach but might become tedious at some point (?)Merging the feature branch to
upstream/staging
- This most probably won't work as the feature branch is not available on upstreamMake pull requests to
upstream/staging
directly - While this is quite convenient but lacks the use of themaster
branch (if PR is made to staging, master would have to be rebased from staging. Might not be a good idea?).
What would be the best or ideal practice in this case to move features from upstreams master to staging for QA in a clean way? Or am I just over-complicating things at this point already?