oliverdavies.uk/content/node.4f6883d1-6421-4350-8ca5-7bfc57da20e9.yml

93 lines
4.2 KiB
YAML

uuid:
- value: 4f6883d1-6421-4350-8ca5-7bfc57da20e9
langcode:
- value: en
type:
- target_id: daily_email
target_type: node_type
target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7
revision_timestamp:
- value: '2025-05-11T09:00:30+00:00'
revision_uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
revision_log: { }
status:
- value: true
uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
title:
- value: |
Which branch should be in which environment?
created:
- value: '2023-09-26T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:30+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2023/09/26/which-branch-should-be-in-which-environment
langcode: en
body:
- value: |
<p>A common question is which [Git] branch should be on which environment.</p>
<p>Most projects I've worked on have two or more environments: production, staging (or test) and development.</p>
<p>Earlier in my career, we used Git Flow heavily. A Git branching workflow based on having different branches - i.e. <code>develop</code>, <code>master</code> and any arbitrary short-lived feature, hotfix and release branches.</p>
<p>These matched nicely with our three environments.</p>
<p>Usually, the <code>develop</code> branch would be used in the development environment. The <code>master</code> branch would be on staging and a tagged release from <code>master</code> on production.</p>
<h2 id="what-about-now%3F">What about now?</h2>
<p>I prefer trunk-based development, where there is one long-lived branch to which everyone commits their changes.</p>
<p>There's only one branch, so you can either follow continuous deployment and use the same branch for all environments - including production - or separate production using a dedicated branch or tag if you need more control.</p>
<p>The mainline branch is used in all pre-production environments, such as staging and development.</p>
<h2 id="what-about-differences-between-the-environments%3F">What about differences between the environments?</h2>
<p>What if we need differences, such as a feature that must be enabled in a particular environment if the same code is on both?</p>
<p>My go-to approach is feature flagging, and this approach is something I'll describe more in tomorrow's email.</p>
format: full_html
processed: |
<p>A common question is which [Git] branch should be on which environment.</p>
<p>Most projects I've worked on have two or more environments: production, staging (or test) and development.</p>
<p>Earlier in my career, we used Git Flow heavily. A Git branching workflow based on having different branches - i.e. <code>develop</code>, <code>master</code> and any arbitrary short-lived feature, hotfix and release branches.</p>
<p>These matched nicely with our three environments.</p>
<p>Usually, the <code>develop</code> branch would be used in the development environment. The <code>master</code> branch would be on staging and a tagged release from <code>master</code> on production.</p>
<h2 id="what-about-now%3F">What about now?</h2>
<p>I prefer trunk-based development, where there is one long-lived branch to which everyone commits their changes.</p>
<p>There's only one branch, so you can either follow continuous deployment and use the same branch for all environments - including production - or separate production using a dedicated branch or tag if you need more control.</p>
<p>The mainline branch is used in all pre-production environments, such as staging and development.</p>
<h2 id="what-about-differences-between-the-environments%3F">What about differences between the environments?</h2>
<p>What if we need differences, such as a feature that must be enabled in a particular environment if the same code is on both?</p>
<p>My go-to approach is feature flagging, and this approach is something I'll describe more in tomorrow's email.</p>
summary: null
field_daily_email_cta: { }