Many companies follow different models of deployment and git flow. Some only require the simple GitHub flow, while others use a more legacy git flow.
If you follow more of the Git Flow, you will likely need to create additional protected branches like DEV
, QA
, or PROD
.
An example workflow which adopts the Git Flow branching strategy
Once you have set up those branch protections, you can then use them later on to help trigger additional workflows and flags.
To protect our new branch(es) and require at least one review and a passing test, perform the following:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the left menu, click Branches.
- Next to "Branch protection rules", click Add rule.
- Under "Branch name pattern", type
DEV
orQA
orPROD
. - Select the Require pull request reviews before merging checkbox.
- Select the Require status checks to pass before merging checkbox.
- Select the Continuous Integration checkbox in the Status checks found in the last week for this repository.
- Click Save changes.
- Repeat for all branches you wish to protect.