Development Process
Developing and Deploying with Branches
We adopted git-flow and its use of environment branches. This means that for each environment (staging and production) we have a branch for it. Whenever someone wants to deploy to staging, they will need to update the staging branch. For production, master. We use a staging environment where our team or clients can review changes together. Having automated deployment from a staging branch helps in keeping the environment as close as possible to production. The idea of this flow was introduced by beanstalkapp.
Branching model
Branching model is like this: develop - destination branch for our Github PRs
staging - automatically deploys to the staging environment
master - automatically deploys to the production environment
Best Practises
Only merge to develop if your changes can be immediately deployed. Consider using feature switches.
Never commit to staging or master branches. Use fast-forward merge from staging.
If develop becomes unstable and cannot be deployed, announce it in the slack channel #tech-infrastructure so that nobody would deploy your changes to production. If a quick fix is not available, proceed to revert your changes as soon as possible.
Merges should only flow in one direction
Example how to make your commits go to production
1) Create a branch
You usually get branch name from clubhouse with git helpers
git checkout -b see-clubhouse/chl33t/title-of-story
This should be done from develop.
2) Pull request
After making the change, create a PR in Github. After the reviewers are done and all conversations are resolved, use the merge button. This will create merge commit that can be used for Release Notes.
3) Merges and deployment
Once the changes are in develop, feel free to deploy to staging by git command git merge origin/develop from staging branch as base branch. Be careful not to create a merge commit, only fast-forward at this point. So full commands would be
git checkout staging
git merge origin/develop
After checking staging env and you have checked your changes, you can merge and deploy to master
git checkout master
git merge origin/staging
Last updated